How to do Color Change of Row of GridView on Select & Open a New Page of Selected Row Item

The following code sample shows how to do Color Change of Row of GridView on Select & Open a New Page of Selected Row Item

 
protected void GridView1_RowDataBound1(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "this.style.cursor='hand';this.style.backgroundColor='orangered'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='white'");
e.Row.Attributes.Add("onclick", "window.open('test.aspx?id=" + DataBinder.Eval(e.Row.DataItem, "uid") + "','myprofilewindow','width=400,height=200,toolbar=0,resizable=0');");

}
}


Comments

Author: Kapil Dhawan17 Jun 2008 Member Level: Gold   Points : 1

Hello
Nice piece of code
Thanks for sharing your knowledge with us.
I hope to see more good code from your side
Regards,
Kapil





Author: ram25 Jun 2008 Member Level: Bronze   Points : 1

Hey help me...

when a particular row is selected.. i want the "uid" to be stored in a variable... how will i do that..?

Author: ram25 Jun 2008 Member Level: Bronze   Points : 1

Hey help me...

when a particular row is selected.. i want the "uid" to be stored in a variable... how will i do that..?

Author: ram25 Jun 2008 Member Level: Bronze   Points : 1

Hey help me...

when a particular row is selected.. i want the "uid" to be stored in a variable... how will i do that..?

Author: Bunty27 Jun 2008 Member Level: Gold   Points : 2

Hi,

Really nice piece of code on how to change color of raow of GridView.

I want to do these changes.

Keep posting such useful code.

Thanks for sharing your knowledge.

Thanks and Regards
S.S.Bajoria



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: