Accessing hidden datagrid field in itemcommand

  • Thread starter Thread starter Not Me
  • Start date Start date
N

Not Me

Hi,

In a datagrid's itemcommand method, I can use
DataGridCommandEventArgs/item/cells/text to bring up a specific field
from a row that was accessed. However, I wish to lookup data from that
row, that is in a hidden field on the datagrid. How can I do this?

I would appreciate a simple answer (if one exists) as you may notice I'm
new to this :p

Cheers,
Chris
 
Chris,

Hidden columns don't render to clients and, naturally, don't come back on
postback. The solution is to hide the column with css rule display:none.
Don't make the column Hidden. Make a css style sheet with a class like this:

..Invisible{display:none}

and specify "Invisible" as CssClass for the column. Something like this:

<asp:BoundColumn DataField="Comment">
<ItemStyle CssClass="Invisible"></ItemStyle><HeaderStyle
CssClass="Invisible"></HeaderStyle>
</asp:BoundColumn>

Then the column will be passed to the browser but still will be hidden.

Eliyahu
 
Hidden columns don't render to clients and, naturally, don't come back on
postback. The solution is to hide the column with css rule display:none.
Don't make the column Hidden. Make a css style sheet with a class like this:

.Invisible{display:none}
and specify "Invisible" as CssClass for the column. Something like this:

<asp:BoundColumn DataField="Comment">
<ItemStyle CssClass="Invisible"></ItemStyle><HeaderStyle
CssClass="Invisible"></HeaderStyle>
</asp:BoundColumn>

Then the column will be passed to the browser but still will be hidden.

Thanks for that!

Chris
 
Back
Top