Reputation: 137
I have a gridview say gv1 . Which has 5 columns. I bind the gridview on the change of a dropdown selection. After binding I make the 4th(gv1.column[3]) and 5th(gv1.column[4])column visible false.
gv1.Columns[3].Visible = false;
gv1.Columns[4].Visible = false;
I am unable to access the column value(these are id's) later. I tried making it visible before accessing still in vain.
{
gv1.Columns[3].Visible = True;
gv1.Columns[4].Visible = True;
int id = Convert.ToInt32(row.Cells[4].Text.ToString().Trim());
}
I get the error at 'id' "Input string was not in a correct format." I found ,All the column for each value is having null value.
Upvotes: 0
Views: 718
Reputation: 35264
Hai avi,
Look at this it may be useful GridViewHideColumn and access its value..
Upvotes: 1
Reputation: 964
You can do one work around.
Because when you set the grid visibility in the server side as INVISIBLE.
The gridview wont be rendered in during the next post back.
So Keep the Grid view in the Div tag. And make the DIV tag style invisible.
So that you can access the gridview value as you like @ the sametime the grid is not visible to the page users.
....Upvotes: 0