The itemcommand event for the datalist will not fire if you rebind
the DataList control everytime the page loads. This event will fire if you
use the viewstate information when the page gets loaded. The reason is that
if you do not use the view state information the control gets new set of
data and it may not be the same data that you were working on before when
you selected any items in the DataList.
E.g. In the following scenario the Itemcommand event will not fire because
the datalist is populated with new data.
Private
Sub
Page_Load(
ByVal
sender
As
System.Object,
ByVal
e
As
System.EventArgs) Handles MyBase .Load
SqlDataAdapter1.Fill(DataSet11)
..
DataList1.DataBind()
End Sub
System.EventArgs) Handles MyBase .Load
SqlDataAdapter1.Fill(DataSet11)
..
DataList1.DataBind()
End Sub
But it will fire in this case because we are using viewstate data.
======================
Private
Sub
Page_Load(
ByVal
sender
As
System.Object,
ByVal
e
As
System.EventArgs) Handles MyBase .Load
If Not IsPostBack Then
SqlDataAdapter1.Fill(DataSet11)
DataList1.DataBind()
End If
End Sub
System.EventArgs) Handles MyBase .Load
If Not IsPostBack Then
SqlDataAdapter1.Fill(DataSet11)
DataList1.DataBind()
End If
End Sub
Hope this helps.