Hi all,
I want to add a class name to a gridview cell take the value from the cell;
following is my code
$("#GridView1 tr td").filter(":not(td:first-child)").each(function () {
var colindex = $(this).closest("tr td").prevAll("tr td").length;
var headertext = $("table[id*=GridView1] th").eq(colindex).text();
var cellText = $(this).text();
if ($.trim(cellText) == '')
{
$(this).css('background-color', 'LightGreen');
}
else
{
var name = $(this).text();
if (headertext == 2500) {
$(this).addClass('a')
}
if (headertext == 2501) {
$(this).addClass('b')
}
var atime = $(this).find('.a').text();
alert(name);
}
});
the problem is class name is added to gridview cell according to condition
but iam not getting the value according to this code
var atime = $(this).find('.a').text();
alert(name);
alert displaying null value
but gridview rendered like this
<td class="a">09:15</td>
<td class="b">08:55</td>
means class value adding correctly.
below is sample out put
workingday 2500 2501 2502 2503 2504 2505 2506 2507
01 Jan 2014 09:15 08:55 NULL NULL NULL NULL NULL NULL
02 Jan 2014 10:15 NULL NULL NULL NULL NULL NULL NULL
how to solve this
Regards
Baiju