Problem with Column set as visible=false

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.
 
W

WJ

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
 
T

tshad

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.
 
T

tshad

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.
 
W

WJ

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
 
T

tshad

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top