How can one change Webdatagrid css at runtime? In my case I had placed Webdatagrid inside UserControl and used this UserControl on multiple page. Now I want that if page1 is clicked, then say red border and some other attributes are displayed for grid and if say page 2 is clicked, then say white border, etc.
One can do it either in codebehind or using jquery.
Inside UserControl, changed css of Webdatagrid like below:
<script type="text/javascript"> $(document).ready(function () { if ($("input[id$=hfIsTab]").val() == null) // Hidden Field defined in Master page $('.igg_Header').css("background-color", "#efe092"); //Tab Page else $('.igg_Header').css("background-color", "#fff"); //Main Page });</script>
In general, one can also do it like below:
$('.class').css("color",((Variable > 0) ? "#009933":"#000"));