<asp:DataGrid id='DataGrid1' runat='server'>
<Columns>
<asp:TemplateColumn HeaderText='Boolean Value'>
<ItemTemplate>
<asp:CheckBox id=CheckBox1 runat='server' onCheckedChanged='chkChanged' Checked=’<%# DataBinder.Eval(Container.DataItem, 'Discontinued') %>’ AutoPostBack='True'>
</asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
VB.NET
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
’Put user code to initialize the page here
If Not IsPostBack Then
’Populate the datagrid
End If
End Sub
protected Sub chkChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Response.Write('CheckChanged Event')
End Sub
C#
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if (!Page.IsPostBack )
{
DataGrid1.DataSource =BindDataClass.BindData ();
DataGrid1.DataBind ();
}
}
protected void chkChanged(object sender , System.EventArgs e )
{
Response.Write('CheckChanged Event');
}
Share with