Accessing hidden datagrid field in itemcommand

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
 
E

Eliyahu Goldin

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
 
N

Not Me

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top