TemplateColumn-- how to make it zero width?

J

Jim Bancroft

Hi everyone,

I have a couple of TemplateColumns in my DataGrid that I need to hide from
view....yet still have their contents available in the code-behind file. My
HTML code looks like this at the moment:

<asp:TemplateColumn>
<ItemTemplate>
<input type="hidden" runat="server" id="FieldID"
value='<%#DataBinder.Eval(Container.DataItem, "myField")%>'>
</ItemTemplate>
</asp:TemplateColumn>

Not much to look at. Still, when I render the DataGrid I can see this
column. It's small (a centimeter in width, maybe?) but enough to notice.

When I set the "Visible" attribute on the TemplateColumn to False I thought
my problems were over, but after doing so my code-behind file was no longer
able to find my "FieldID" variable during postback. I've since set the
"ItemStyle-Width" attribute to zero but the column still peeks out.

Does anyone know how I can hide this column and still have my hidden form
variables available during postback? Thanks for the assist.

-Jim
 
B

Brock Allen

Not much to look at. Still, when I render the DataGrid I can see this
column. It's small (a centimeter in width, maybe?) but enough to
notice.

Try removing all the whitespace before and after the <input>
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top