D
dilip.movva
Hi,
In the ItemDataBound of my datagrid I am creating a checkbox
dynamically. I have the eventhandler defined for CheckedChanged of the
check box. The event is not firing. The grid is bound in the
Page_Prerender method. My code is something like this
Private Sub grdMissingData_ItemDataBound(ByVal sender As Object, ByVal
e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles
grdMissingData.ItemDataBound
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
If ((e.Item.Cells(5).Text <> "Yes") And
(rdDataTypes.SelectedIndex = 0)) Then
Dim cbx As New CheckBox
cbx.EnableViewState = True
cbx.AutoPostBack = True
AddHandler cbx.CheckedChanged, AddressOf
Me.CheckBoxChangedEvent
cbx.ID = e.Item.ItemIndex
Dim productIDLabel As Label =
CType(e.Item.Cells(0).FindControl("prodid"), Label)
cbx.Checked =
IsOnscreenItemSelected(productIDLabel.Text.Trim)
'cbx.ID = e.Item.ItemIndex
e.Item.Cells(5).HorizontalAlign =
HorizontalAlign.Center
e.Item.Cells(5).Controls.Add(cbx)
End If
End If
End Sub
Private Sub CheckBoxChangedEvent(ByVal sender As Object, ByVal e As
System.EventArgs)
' Changed Event Method
End Sub
Is there some thing i am missing. Can someone help me.
Thanks
Dilip
In the ItemDataBound of my datagrid I am creating a checkbox
dynamically. I have the eventhandler defined for CheckedChanged of the
check box. The event is not firing. The grid is bound in the
Page_Prerender method. My code is something like this
Private Sub grdMissingData_ItemDataBound(ByVal sender As Object, ByVal
e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles
grdMissingData.ItemDataBound
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
If ((e.Item.Cells(5).Text <> "Yes") And
(rdDataTypes.SelectedIndex = 0)) Then
Dim cbx As New CheckBox
cbx.EnableViewState = True
cbx.AutoPostBack = True
AddHandler cbx.CheckedChanged, AddressOf
Me.CheckBoxChangedEvent
cbx.ID = e.Item.ItemIndex
Dim productIDLabel As Label =
CType(e.Item.Cells(0).FindControl("prodid"), Label)
cbx.Checked =
IsOnscreenItemSelected(productIDLabel.Text.Trim)
'cbx.ID = e.Item.ItemIndex
e.Item.Cells(5).HorizontalAlign =
HorizontalAlign.Center
e.Item.Cells(5).Controls.Add(cbx)
End If
End If
End Sub
Private Sub CheckBoxChangedEvent(ByVal sender As Object, ByVal e As
System.EventArgs)
' Changed Event Method
End Sub
Is there some thing i am missing. Can someone help me.
Thanks
Dilip