473,399 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

TemplateColumn-- how to make it zero width?


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


Nov 19 '05 #1
2 1508
> 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>

-Brock
DevelopMentor
http://staff.develop.com/ballen


Nov 19 '05 #2
Jim,

Leave the width alone. Use a css rule display:none.

Eliyahu

"Jim Bancroft" <as******@nowhere.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...

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

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: .rhavin | last post by:
I'm trying to put Accords above my Lyrics. Unfortunately, it's all fine in Opera but won't work in IE... any suggestions? (thanx for help) example-code: <html><head> </head><body> <p...
5
by: Prateek | last post by:
Hi, How can I change the width of a column in datagrid control? TIA Prateek
28
by: Andreas Prilop | last post by:
Jukka reports on http://www.cs.tut.fi/~jkorpela/chars/spaces.html that Internet Explorer 6 fails on the "zero width space" U+200B ​ Is this observation still valid? For which versions of MS...
1
by: pmgriffin | last post by:
Hi all, i'm attempting to overcome the problem of table cell contents overflowing by inserting zero-width spaces into the content string. The scheme is working correctly in that i know longer...
2
by: Charleees | last post by:
Hi all, I have a DataGrid with Template Columns..... There are LAbels,Linkbuttons in the Single Row.. I have to set the Constant Column width for those Template Columns in Grid... Wat...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.