D
dev648237923
I do my updating in the code-behind (long story). I need an ID field in my
DtatGrid to pass to my Stored Proceedure but I do not want that column to
show up on the screen. If I set the GridView column to Visible="false" then
in the code behind when I need to retrieve the ID the below gives an error:
int MyID = int.Parse(GridView1.Rows[e.RowIndex].Cells[1].Text);
So I came up with what I think works well for hiding the column but still
leaving it visible to the code behind:
In the aspataBound tag I do: HeaderStyle-CssClass="hidetd"
ItemStyle-CssClass="hidetd"
Then in my stylesheet I have:
..hidetd { display: none; }
This causes the column not to show on the screen but to still be there so I
can get items from it with GridView1.Rows[e.RowIndex].Cells[1].Text.
I would appretiate if there is a better way or if this way has any unforseen
flaws to hear your comments.
Thank you!
DtatGrid to pass to my Stored Proceedure but I do not want that column to
show up on the screen. If I set the GridView column to Visible="false" then
in the code behind when I need to retrieve the ID the below gives an error:
int MyID = int.Parse(GridView1.Rows[e.RowIndex].Cells[1].Text);
So I came up with what I think works well for hiding the column but still
leaving it visible to the code behind:
In the aspataBound tag I do: HeaderStyle-CssClass="hidetd"
ItemStyle-CssClass="hidetd"
Then in my stylesheet I have:
..hidetd { display: none; }
This causes the column not to show on the screen but to still be there so I
can get items from it with GridView1.Rows[e.RowIndex].Cells[1].Text.
I would appretiate if there is a better way or if this way has any unforseen
flaws to hear your comments.
Thank you!