Select a row in an asp:GridView without using a Select Command

Posted by Bhasker under Regular Expressions on 9/8/2010 | Points: 10 | Views : 1870 | Status : [Member] | Replies : 2
Dear all
I having grid view with ten rows. when i take the cursor on the row, it should show the link with some background color.
Each row will then behave like a link, and when you select one it can drive the behavior of another control(s) on your page
i am using following code.. but its not working ...
pl send me new idea or if correct this if i m doing any wrong.
protected void PeopleGridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{

e.Row.Attributes["onmouseover"] = "this.style.background-color:#b0e0e6;this.style.cursor='hand';this.style.textDecoration='underline';";
e.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';";

e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.PeopleGridView, "Select$" + e.Row.RowIndex);
}
}




Responses

Posted by: Shankul2784 on: 9/8/2010 [Member] Bronze | Points: 25

Up
0
Down
Hi,

Better way you can put a div for a row & then use the javascript to change the background.

Thanks & Regards,

Shailesh

Bhasker, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bhasker on: 9/14/2010 [Member] Starter | Points: 25

Up
0
Down
sir
how to use the java script to change the background.pl send me idea ..

Bhasker, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response