Wednesday, August 10, 2011

How to get Hidden Value in GridView

Once a column's Visible property is set to Hidden, no longer can we access it, since it returns blank.

To overcome that we can do 4 things
1) Use DATAKEY property and to hidden column ID.
GridView.DataKeys[0].Value.ToString();
 
2) Use TEMPLATE COLUMN and make it visible and access the values using FindControl.
Label lblID = (Label) GridView.Rows[0].FindControl("lblMyId");

3) Using a sylesheet ,set the property display=none, and can get the values.
GridView.Rows[0].Cell[0].Text

4) After databinding, set the visible property of the column.
   GridView.Columns[0].Visible = false;


http://www.dotnetspark.com/kb/1937-how-to-get-hidden-column-value-gridview.aspx

Wednesday, August 3, 2011

Pages Not Displaying CSS/Themes

If we enable authentication in web.config, the master page will not display the CSS styles. The reason, one must login to access all folders and files (including styles and pictures).

To overcome this issue, give permission to the folder containing CSS and pictures in the WEB.CONFIG in the location path and authorization in system.web.