Wednesday, August 30, 2006

Datagrid Itemcommand

 
How to Handle ItemCommand event for DataGrid ???

Ans.
suppose, you have two button columns in your datagrid , now,
when u click either of the button ItemCommand event will be

fired...
Now, how to distinguish between those two Button

Columns ( Which button is pressed )

}

again it is simple ....

Ans.

Item Command event will holds two objects..

1. Object source,

2. System.Web.UI.WebControls.DataGridCommandEventArgs e


by using 'e' now see the magic

if ((LinkButton)e.CommandSource).CommandName == "Edit")

(just typecast the type of your source)

that's it ... :))



.net Tutorials

ASP.NET 2.0 Tutorial