ASP.NET - How to fire gridview row created event from button click

Asked By balaji mogadali on 09-May-12 05:16 AM
hi frds

How to fire gridview row created event from button click
i had to take a itemtemplate or to create dynamic controls
pls help
Venkat K replied to balaji mogadali on 09-May-12 05:29 AM
I think you can't raise the row created event directly from a button click.
but you can re-bind the gridview in the button so that internally it will fire teh gridview1.rowcommand event implicitly.
kalpana aparnathi replied to balaji mogadali on 09-May-12 06:51 AM
hi,

Try below code:


protected void GridView1_RowCreated(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
{
   
if (e.Row.RowType == DataControlRowType.DataRow) {
        e
.Row.Attributes["onmouseover"] = "this.style.cursor='pointer';this.style.textDecoration='underline';";
        e
.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';";
        e
.Row.ToolTip = "Click to select row";
        e
.Row.Attributes["onclick"] = this.Page.ClientScript.GetPostBackClientHyperlink(this.GridView1, "Select$" + e.Row.RowIndex);
   
}
}

Regards,
Somesh Yadav replied to balaji mogadali on 09-May-12 07:41 AM
try this,

http://www.codeproject.com/Articles/36528/GridView-all-in-one

Hope it helps you.