Wednesday, December 16, 2009

Finding a Control at RowCommand Event of a GridView

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Search") //Button click is causing event fire
{
GridViewRow row = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
Label lbl1 = row.FindControl("Label1") as Label;
string s = lbl1.Text;
}
}

No comments:

Post a Comment

Followers