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');");
} }
|
| Author: Kapil Dhawan 17 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: ram 25 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: ram 25 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: ram 25 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: Bunty 27 Jun 2008 | Member Level: Diamond 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
|