Hi ,
Please tell me how to access linkbutton in a gridview at row command event?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nethra R SPosted Dec 13, 2011, 4:42 AM
Ur code gives object reference not set error
Pankaj RanaPosted Dec 13, 2011, 12:54 AM
This code can solve you problem
protected void Grid1_RowCommand(object sender,GridViewCommandEventArgs e)
{
LinkButton lnkAdd=(LinkButton)grdRecipe.FooterRow.FindControl("lnkadd");
Response.Write(lnkAdd.Text);//Print add on browser
}
Nethra R SPosted Dec 12, 2011, 6:00 AM
I want to access the linkbutton by its ID not by CommandName and that too at RowCommand Event
Nethra R SPosted Dec 12, 2011, 3:33 AM
My linkbutton is in the Gridview footer template like this:
I have one linkbutton in empty data template
At the row command event of of the linkbutton in the empty data template i want to access the link button from footer template
<%--
Pankaj RanaPosted Dec 12, 2011, 3:16 AM
Linkbutton in a gridview at row command event can be access which the help of CommandName
propery of LinkButton
as
}
Satyapriya NayakPosted Dec 12, 2011, 3:13 AM
Please refer the below link
http://www.aspdotnetcodes.com/ReadTips_Get_GridView_RowIndex_RowCommand_Event.aspx
http://www.aspsnippets.com/Articles/ASP.Net-GridView---Get-Row-Index-on-RowCommand-and-Click-events.aspx
Thanks