GridView with clickable rows

If you need to have a GridView with rows that you can click on you will need to set the onClick event for each row.

Here is a code sample for the RowDataBound event of a GridView.
This examples pulls the value of cell 0 and appends it to the url.

protected void grd_RowDataBound(object sender, GridViewRowEventArgs e)
{
GridView grid = (GridView)sender as GridView;

//Only format data rows
if (e.Row.RowType == DataControlRowType.DataRow)
{

string urlLink = “Link?number=” + e.Row.Cells[0].Text.ToString();
e.Row.Attributes[“onClick”] = “location.href='” + urlLink + “‘”;

}
}

Browser Compatibility Check for IE versions

When doing web development you rarely have a one browser to support.  Having to test with multiple browsers is hard and even more difficult with different versions of the same browsers.  Now there is a solution for different versions of IE.  I used to keep different VM’s with
different versions of IE.  That was quite a pain.

There is now a tool that will allow you to view you web pages in different versions of IE (5.5, 6, 7, and 8).

No back button

If your web app just can’t tolerate a user clicking the back button, you can tell the browser to not cache the page. Most of the time it will listen if you use this code, which covers all the bases:

Response.Expires = 60
Response.ExpiresAbsolute = DateAdd(DateInterval.Day, -1, Now())
Response.AddHeader(“pragma”, “no-cache”)
Response.AddHeader(“cache-control”, “private”)
Response.CacheControl = “no-cache”