如何操作GridView模板里的控件
如何操作GridView模板里的控件
<asp:GridView ID= "GridView1 " runat= "server " CellPadding= "4 " <Columns>
<asp:BoundField HeaderText= "用户名 " DataField= "username " />
<asp:BoundField HeaderText= "姓别 " DataField= "sex " />
<asp:BoundField HeaderText= "留言内容 " DataField= "body " />
<asp:BoundField HeaderText= "QQ号码 " DataField= "qq " />
<asp:BoundField HeaderText= "E-Mail " DataField= "email " />
<asp:TemplateField HeaderText= "是否有效 ">
<ItemTemplate>
<asp:CheckBox id= "isValue " Enabled=false Checked= <%# (bool)Eval( "IsHidden ") %> runat= "server "> </asp:CheckBox>
<asp:Button id= "Button1 " runat= "server " Text= "Button "> </asp:Button>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ButtonType= "Button " ShowEditButton= "True " />
</Columns>
</asp:GridView>
刚绑定的时候checkbox是不可编辑的,我想在按了编辑按钮后checkbox可以编辑,请对checkbox进行操作,直接isValue.Enabled=True是肯定的了
------解决方案--------------------加一个EditItemTemplate
<asp:GridView ID= "GridView1 " runat= "server " CellPadding= "4 " <Columns>
<asp:BoundField HeaderText= "用户名 " DataField= "username " />
<asp:BoundField HeaderText= "姓别 " DataField= "sex " />
<asp:BoundField HeaderText= "留言内容 " DataField= "body " />
<asp:BoundField HeaderText= &qu