Problem with Column set as visible=false

  • Thread starter Thread starter tshad
  • Start date Start date
T

tshad

I have a column in a list where I need to keep track of some data (but not
show it) and am setting it as false. This works fine in IE, but Netscape
and Mozilla show a little space where the column is (even though they don't
show any data).

The line is:

<td>
<asp:Label visible="false" id="lblPositionID" runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.PositionID") %>' />
</td>

Is there a way to make it work correctly in Netscape and Mozilla?

Thanks,

Tom.
 
You might try adding some code to your web.config file to force Mozilla
and Netscape to render as "uplevel" browsers. By default, ASP.net
considers newer version of non-IE browsers as only understanding HTML
3.2. You can add the code specified at
http://blogs.biasecurities.com/jim/archive/2004/11/03/740.aspx, and it
will render in more up to date HTML, which might fix your issue.

Jason
 
tshad said:
I have a column in a list where I need to keep track of some data (but not
show it) and am setting it as false

I would use the Html/Hidden Field instead.

John
 
tshad said:
That worked. I never think about using html attributes when using asp
tags.

Actually, it didn't work. I was thinking of something else when I tried it.

How would I use this with asp.net? The tag has to be filled from the
server.

<asp:Label visible="false" id="lblPositionID" runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.PositionID") %>' />

How would I change this to work with HTML?

Thanks,

Tom.
 
tshad said:
Where in web.config would this go?

Found out where it goes, but it didn't seem to fix the problem.

It still gives me:

1 <td width="100">
2 <span id="DataList1__ctl0_lblRefCode">MD102465M</span>
3 </td>
4 <td>
5
6 </td>
7 <td width="210">
8 <span id="DataList1__ctl0_lblJobTitle">Desktop Computer Support
Technician</span>
9 </td>

You can see the <td></td> tags at lines 4-6. In IE, these are gone.

The lines I am using to generate this is:
*****************************************************************************************
<td width="100">
<asp:Label id="lblRefCode" runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.ReferenceCode") %>' />
</td>
<td>
<asp:Label visible="false" id="lblPositionID" runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.PositionID") %>' />
</td>
<td width="210">
<asp:Label id="lblJobTitle" runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.JobTitle") %>' />
</td>
******************************************************************************************

I need to hide the column but keep the data for use at postback.

Thanks,

Tom.
 
tshad said:
How would I use this with asp.net? The tag has to be filled from the
server.

When you drop an Html/Hidden field onto an Asp.Net form (naming it as, say
"txtField"), the VS.Net generates two lines:

1. From code behind: "protected System.Web.UI.HtmlControls.HtmlInputHidden
txtField;"
2. From Html: "<P><INPUT id="txtField" type="hidden" name="txtField"
runat="server">"

From code behind, you can manipulate this hidden field by giving it a value,
say: txtField.Value="SomeThing";
From the Html document, you can use Java Script to manipulate the hidden
field, such as:

Form1.txtField.value="SomeThing";
Alert("Here="+txtField.value);

John
 
WJ said:
When you drop an Html/Hidden field onto an Asp.Net form (naming it as, say
"txtField"), the VS.Net generates two lines:

1. From code behind: "protected System.Web.UI.HtmlControls.HtmlInputHidden
txtField;"
2. From Html: "<P><INPUT id="txtField" type="hidden" name="txtField"
runat="server">"

From code behind, you can manipulate this hidden field by giving it a
value, say: txtField.Value="SomeThing";
From the Html document, you can use Java Script to manipulate the hidden
field, such as:

Form1.txtField.value="SomeThing";
Alert("Here="+txtField.value);

Got it.

Thanks,

Tom
 

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