Katya85S
Programmer
- Jul 19, 2004
- 190
In asp.net project (vb.net), in dataGrid I use CheckBox:
<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox id=chk Enabled=false runat="server" checked='<%# DataBinder.Eval(Container.DataItem, "Display") %>'>
</asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
It is disabled, if no events are hired. I want to enable the checkbox on DataGrid’s Edit command, thus users could check-uncheck record if needed. I thought this code (below) should do it. On Edit command DataGrid turns into its Edit stage, though checkbox of the selected record remains disabled. Any ideas?
Sub dg_Edit(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
Dim chknew As CheckBox = e.Item.FindControl("chk")
chknew.Enabled = True
dg.EditItemIndex = e.Item.ItemIndex
BindData()
End Sub
I would appreciate any help.
Thank you all in advance.
<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox id=chk Enabled=false runat="server" checked='<%# DataBinder.Eval(Container.DataItem, "Display") %>'>
</asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
It is disabled, if no events are hired. I want to enable the checkbox on DataGrid’s Edit command, thus users could check-uncheck record if needed. I thought this code (below) should do it. On Edit command DataGrid turns into its Edit stage, though checkbox of the selected record remains disabled. Any ideas?
Sub dg_Edit(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
Dim chknew As CheckBox = e.Item.FindControl("chk")
chknew.Enabled = True
dg.EditItemIndex = e.Item.ItemIndex
BindData()
End Sub
I would appreciate any help.
Thank you all in advance.