access to DataGrid's TemplateColumn

  • Thread starter Thread starter lupina
  • Start date Start date
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?
 
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
 
So, is there any other way to store hidden data (eg. string ) in DataGrid's
DataRow?
 
Yes, you can hide html elements by setting css rule display:hidden.

Eliyahu
 
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

Back
Top