GridView column visible property
-
I have a GridView in my Web page. For one of the columns i set visible = false. I looped through the rows in the GridView and tried to get the value for the column for which the visible property is false and i got an empty string. When i set the visible property to true i was able to retrieve the value. Is this the normal behaviour of the GridView or am i doing any thing wrong here. Is there a way to get the value for a particular cell even though the visible property is false Thanks Kal
-
I have a GridView in my Web page. For one of the columns i set visible = false. I looped through the rows in the GridView and tried to get the value for the column for which the visible property is false and i got an empty string. When i set the visible property to true i was able to retrieve the value. Is this the normal behaviour of the GridView or am i doing any thing wrong here. Is there a way to get the value for a particular cell even though the visible property is false Thanks Kal
-
AFAIK, this behaviour is by design, and you have a couple of options to work around: + Don't use Visible property, use stylesheet to hide the column. + Save the value of the insivible column somewhere else like the DataKeys collection of the GridView.
Hi Dear, If you use RowDataBound event of gridveiw i=0,1,2.... [column number] if (e.Row.RowType==DataControlRowType.Header ||e.Row.RowType==DataControlRowType.DataRow) e.Row.Cells[2].Visible = false; it will hide the column and you can use column value in your project there wont be any problem. if you need further help just email me. thanks
Naveed Kamboh