Click here to Skip to main content
15,902,112 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi,
I have a gridview called GriedView1 and I want to change the background color of a row using jquery.I'm using some master page and I tried using following code.

$('table[#id=GridView1] tr').css({"background-color":"#bbb"});

above code does not work.Can you please help me to solve this problem!

Thank you.
Posted

A Gridview is just a table in the client side.

Just inspect the client side html when in the browser. Javascript works in the client side, so you need to do this in the client side.

Just as you did, I think the only thing that you need focus is the actual id of the table that is rendered through the GridView.

Just go to View- Source and see what is the id of the Table.

:rose:
 
Share this answer
 
wrote:
GriedView1


One has to ask why it's called that.


wrote:
$('table[#id=GridView1] tr').css({"background-color":"#bbb"});


Your first step would be to look at the actual HTML to see what the client side Id is. The ClientID property can be used on the server side to emit this name.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900