access to DataGrid's TemplateColumn

L

lupina

Hi,
I'm trying to get access to template column when Update Command is fired,
but my template column isn't editable - I only show data in it :

<asp:TemplateColumn Visible="False" HeaderText="wm_id">
<ItemTemplate>
<%#Get_Wm_Id()%>
</ItemTemplate>
</asp:TemplateColumn>


Additional , this column is hidden, that user cannot see it.

How can I read that column in DataGrid_UpdateCommand method?
 
E

Eliyahu Goldin

Note, the controls with Visible=false don't get rendered to the client.
Naturally, you can't access them in postbacks. You can hide the column with
a css rule display:none, then you will see it in postbacks.

Eliyahu
 
L

lupina

So, is there any other way to store hidden data (eg. string ) in DataGrid's
DataRow?
 
E

Eliyahu Goldin

Yes, you can hide html elements by setting css rule display:hidden.

Eliyahu
 
E

Eliyahu Goldin

You can apply css rules to html elements inside the column. Enclose your
data to a <span> element like this:

<asp:TemplateColumn Visible="False" HeaderText="wm_id">
<ItemTemplate>
<span style="display:none"><%#Get_Wm_Id()%></span>
</ItemTemplate>
</asp:TemplateColumn>


Eliyahu
 

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,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top