Reputation: 7984
I have grid that I built this way
Name Amt Invoice
Tom 100 bla bla
Liz 200 bla bla
Sue 300 bla bla
Edd 400 bla bla
Mat 500 bla bla
I made the invoice colum invisible (Visible = False)
in my code When user select row 1 I need to read invoice details in the code behind.
I tried this
protected void grd_SelectedIndexChanged(object sender, EventArgs e)
{
string Invoice = grd.SelectedRow.Cells[3].Text;
but Invoice is always empty
it works when I change the visibility to True and I can read it then
but I dont want the user to see this column
how can I do that?
Upvotes: 0
Views: 39
Reputation: 4518
By setting column Visible = True
, the data is emitted from the viewstate. Therefore the data does not appear on postback. To get around this, you can set Visible = False
and hide the column using css. Alternativly use a hidden input.
Upvotes: 1