Hi,
How to use child control Events in Datalist.
I have send u my code please refer it and rep.
Button imgButton = new Button();
imgButton = (Button)sender;
DataListItem row = default(DataListItem);
row = (DataListItem)imgButton.NamingContainer;
int index = 0;
index = row.ItemIndex;
int i = 0;
Label hdnId = new Label();
hdnId = (Label)row.FindControl("lblid");
i = hdnId.Text;
Label lblNmae = new Label();
lblNmae = (Label)row.FindControl("Label1");
string iname = null;
iname = lblNmae.Text;
Thanks,
Jitendra Patel
Karthikeyan AnbarasanPosted Apr 8, 2011, 5:38 AM
piyush sardharaPosted Apr 8, 2011, 5:38 AM
you can accept my answer
thanks
Jitendra PatelPosted Apr 8, 2011, 5:30 AM
I have understood......
Keep it up..........
Again Thanks...........
piyush sardharaPosted Apr 8, 2011, 5:23 AM
The Repeater, DataList, and DataGrid controls support event bubbling. What is event bubbling? Event Bubbling refers to the ability of a control to capture the events in a child control and bubble up the event to the container whenever an event occurs. The DataList control supports the following six events:
ItemCreated
ItemCommand
EditCommand
UpdateCommand
DeleteCommand
CancelCommand
We will now discuss how we can work with the events of the DataList control. In order to handle events when working with a DataList control, include a Button or a LinkButton control in the DataList control. These controls have click events that can be used to bubble up the triggered event to the container control, that is, the DataList.
The following code snippet illustrates how you can attach a handler to an ItemCommand event of a DataList control:
The corresponding handler that gets called whenever the event is fi red is as follows:
void ItemCommandEventHandler (Object src, DataListCommandEventArgs e ....)
{
//Some event handling code
}
Simi larly, you can handle the ItemCreated event by specifying the handler in the .aspx file as follows:
The corresponding handler that is triggered whenever this event occurs is as follows.
void ItemCreatedEventHandler ( Object src, DataListCommandEventArgs e )
{
//Some event handling code
}
Similarly, you can use the CancelCommand event by specifying the event handler in your .aspx file as follows:
The corresponding handler that is triggered whenever this event occurs is as follows.
void ItemCreatedEventHandler ( Object src, DataListCommandEventArgs e )
{
//Some event handling code
}
Similarly, you can use the CancelCommand event by specifying the event handler in your .aspx file as follows:
The corresponding event handler that would get fi red is as follows:
void CancelCommandEventHandler ( Object src, DataListCommandEventArgs e )
{
//Some event handling code
}