gridview实现编辑为什么对asp:TemplateField无效
[code]<asp:GridView ID="grwBook" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None" AutoGenerateColumns="false" AllowPaging="true" DataKeyNames="ID" OnPageIndexChanging="grwBook_PageIndexChanging" PageSize="10" OnRowEditing="grwBook_RowEditing"
OnRowUpdating="grwBook_RowUpdating" >
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="ID" HeaderText = "ID" />
<asp:BoundField DataField="UserName" HeaderText="姓名">
<ItemStyle Width="60px" />
</asp:BoundField>
<asp:TemplateField HeaderText="评论">
<ItemTemplate>
<%#common.qqReplace(Eval("Comments").ToString()) %>
<h5>管理员回复:</h5><font color="#DB3434"><%#Eval("Replay") %></font>
</ItemTemplate>
<ItemStyle Width="500" />
</asp:TemplateField>
<asp:BoundField DataField="Postdate" HeaderText="日期" />
<asp:HyperLinkField DataNavigateUrlFields="newsid" DataNavigateUrlFormatString="../news_zi.asp?id={0}" HeaderText="文章" DataTextField="newsid" target="_blank" />
<asp:TemplateField HeaderText="操作" >
<ItemTemplate>
<asp:CheckBox runat="Server" ID="cbxId" />
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField HeaderText="编辑" ShowEditButton="True" />
</Columns>
<PagerSettings Mode=NumericFirstLast PageButtonCount="10" FirstPageText="第一页" LastPageText="末页" />
</asp:GridView>[/code]
我只想实现“管理员回复”可编辑,这样的话我就等于可以回复评论了,但使用中却只有asp:BoundField呈现可编辑状态, asp:TemplateField中的却不可以。
[attach]92968[/attach] EditTemplate 把不需要编辑的字段指定 readonly:true
把模板列制定 编辑模板
页:
[1]