[RESOLVED]How to set width of th in gridview


I want to set the width of th of gridview to 60px.except the first th.

how to do this by jquery.



I don’t think I understand your question.

You want to set the gridview or table to have a total width of 60.

You want to specify the width of the first th.

So maybe something like this?  In this example I have a table with id of myTestTable.  It has two TH and a couple of rows.  I set the overall width of my table to 200px and then I set the first TH to a width of 150px leaving the other TH with only 50px.
 Is this something like what you are looking to do?

$(function () {
    $("#myTestTable").css("border", "1px solid blue").css("width", "200px");
    $("#myTestTable th:first-child").css("width", "150px");

Hi Sheldons thanks for your reply.

my question is my application contains a gridview with th as

Tourdate 101 102 103 104.

i want to set the width of th’s 101,102..104.

no need to set the width of tourdate. because other fields width will vary according to data.

i think now u can understand my question.

I made a slight correction in ur code.

this is the solution

 $("#GridView3 th:not(:first-child)").css("width", "62px");

Leave a Reply