Posts

Showing posts from August, 2009

Apply CSS Class based on Browser

  Do you need to modify couple of CSS class attributes depending on browser?   There are various ways to achieve it. But I found this very simple approach for working on this issue.                 There are modifications needed at 2 places in the code. One is in the HTML body / ASPX page and other is in CSS file. Suppose there is DIV in your mark up and you want to apply different CSS class attributes if browse is IE6 / IE7/ IE8. Then just add a container div with id IE7 to this div. It can be added as this on ASPX page (Note- you can add this in Master page / specific page if you are not using Master Pages): - <!--[if IE 7]><div id="ie7"><![endif]-->       <div class=”category”> This is div of interest where ie7 specific rendering should be done.       </div>   <!--[if lte IE 7]></div><![endif]-->                 The second change is in CSS file. All classes which should

Optimized way to get count of rows from a table

  To get no. of rows from a table we usually use query Select count(*) from table_name But this query reads complete table to return no. of Optimized way for performing this query is Select rows from sysindexes where id= Object_Id(‘table_name’) Technorati Tags: Sql Sever