Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: User Control DataList Events


Message #1 by "Shawn Vogel" <shawnvogel@h...> on Wed, 22 May 2002 18:18:59
I have a User Control that Contains a DataGrid.  I have created the code 
behind method for the edit event.  Unfortunately the events is not being 
fired when I run the control and click on the edit link.

I have searched the web and found numerous pages that suggest that events 
have to be trapped differently with a user control but non of them explain 
how to do it.

The wrox book explains how to trap an event for a dropdownlist which is 
pretty straight forward and works but doesn't mention how to get events to 
fire for a DataGrid or DataList.

Here's a bit of the code from the code behind:

this.DataListServiceGroup.EditCommand += new 
System.Web.UI.WebControls.DataListCommandEventHandler
(this.DataListServiceGroup_EditCommand);


private void DataListServiceGroup_EditCommand(object source, 		
	System.Web.UI.WebControls.DataListCommandEventArgs e)
{
GetServiceGroup();
DataListServiceGroup.EditItemIndex = e.Item.ItemIndex;
			DataListServiceGroup.DataBind();
		}


  Return to Index