473,412 Members | 2,005 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,412 software developers and data experts.

Datagrid invisible Label/Textbox does not generate HTML Object?

Hi, All:

I have a datagrid with TemplateColumn as following:

<asp:TemplateColumn Visible="False" >
<ItemStyle Width="0px"></ItemStyle>
<ItemTemplate>
<asp:Label id="lblMin_Value" Visible=False runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.min_value") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>

I set Visible = false for this column because I do not want end user
see this column. But
If I check the html source, I did not see any HTML code for this label.
If the Visble is true, on the source code of HTML, I will see <Span id
= blahblah....>. I have a client side javascript to using this label's
value (actually the span's innerText), but the HTML does not have this
<Span object, so I could get the value of this min_value.

I also tried to set Visible =FAlse for <ASP:Label , it is the same.
I tried using <ASP:textbox > it is the same, not HTML object generated.
Does anybody have experience on this before? How should I Invisible an
Label/Textbox in datagrid but generate HTML Object so that JavaScript
can access?

Thanks a lot
-Rockdale

Jun 6 '06 #1
3 2870

Add a hidden object.

what you see is what is supposed to be doing.
<input id="hidUserUUID" type="hidden" name="hidUserUUID" runat="server">

something like that.

"rockdale" <ro************@gmail.com> wrote in message
news:11********************@j55g2000cwa.googlegrou ps.com...
Hi, All:

I have a datagrid with TemplateColumn as following:

<asp:TemplateColumn Visible="False" >
<ItemStyle Width="0px"></ItemStyle>
<ItemTemplate>
<asp:Label id="lblMin_Value" Visible=False runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.min_value") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>

I set Visible = false for this column because I do not want end user
see this column. But
If I check the html source, I did not see any HTML code for this label.
If the Visble is true, on the source code of HTML, I will see <Span id
= blahblah....>. I have a client side javascript to using this label's
value (actually the span's innerText), but the HTML does not have this
<Span object, so I could get the value of this min_value.

I also tried to set Visible =FAlse for <ASP:Label , it is the same.
I tried using <ASP:textbox > it is the same, not HTML object generated.
Does anybody have experience on this before? How should I Invisible an
Label/Textbox in datagrid but generate HTML Object so that JavaScript
can access?

Thanks a lot
-Rockdale

Jun 6 '06 #2
rockdale wrote:
Hi, All:

I have a datagrid with TemplateColumn as following:

<asp:TemplateColumn Visible="False" >
<ItemStyle Width="0px"></ItemStyle>
<ItemTemplate>
<asp:Label id="lblMin_Value" Visible=False runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.min_value") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>

I set Visible = false for this column because I do not want end user
see this column. But
If I check the html source, I did not see any HTML code for this
label. If the Visble is true, on the source code of HTML, I will see
<Span id = blahblah....>. I have a client side javascript to using
this label's value (actually the span's innerText), but the HTML does
not have this <Span object, so I could get the value of this
min_value.

I also tried to set Visible =FAlse for <ASP:Label , it is the same.
I tried using <ASP:textbox > it is the same, not HTML object
generated.
Does anybody have experience on this before? How should I Invisible an
Label/Textbox in datagrid but generate HTML Object so that JavaScript
can access?

The effect of setting any server control's Visible property to False is
to prevent that control from being rendered on the client.

You will need to use a client-side solution for this, perhaps a css
class:

<style>
.invisible {display:none}
</style>
....
asp:Label id="lblMin_Value" CssClass="invisible" runat="server" Text=
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jun 6 '06 #3
Brilliant.

I came with
<asp:TemplateColumn ItemStyle-CssClass="invisible"
FooterStyle-CssClass="invisible" HeaderStyle-CssClass="invisible"
ItemStyle-Width=0>

and it works perfect

Thank you very much
-rockdale
Bob Barrows [MVP] wrote:
rockdale wrote:
Hi, All:

I have a datagrid with TemplateColumn as following:

<asp:TemplateColumn Visible="False" >
<ItemStyle Width="0px"></ItemStyle>
<ItemTemplate>
<asp:Label id="lblMin_Value" Visible=False runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.min_value") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>

I set Visible = false for this column because I do not want end user
see this column. But
If I check the html source, I did not see any HTML code for this
label. If the Visble is true, on the source code of HTML, I will see
<Span id = blahblah....>. I have a client side javascript to using
this label's value (actually the span's innerText), but the HTML does
not have this <Span object, so I could get the value of this
min_value.

I also tried to set Visible =FAlse for <ASP:Label , it is the same.
I tried using <ASP:textbox > it is the same, not HTML object
generated.
Does anybody have experience on this before? How should I Invisible an
Label/Textbox in datagrid but generate HTML Object so that JavaScript
can access?

The effect of setting any server control's Visible property to False is
to prevent that control from being rendered on the client.

You will need to use a client-side solution for this, perhaps a css
class:

<style>
.invisible {display:none}
</style>
...
asp:Label id="lblMin_Value" CssClass="invisible" runat="server" Text=
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


Jun 7 '06 #4

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

Similar topics

0
by: lu | last post by:
I have a page with datagrid (for viewing, delete,edit,update) and text fields with button to add info to database. When user comes to page the datagrid selects info from database, binds in...
6
by: Derek | last post by:
I have an aspx page where I use a reversebind and templates to edit the entire datagrid at one time. I added a textbox and button to change the parameter criteria and then rerun the databind2...
12
by: James Norton-Jones | last post by:
Hi, Am I trying to hold the data of a DataGrid in a label so that when the form is reposted the DataGrid can be repopulated. The problem I am having is that I don't understand how to get the...
1
by: tshad | last post by:
I can't seem to get insert into a DataGrid to work. I am using an example from the net and made changes to work on my computer. The grid comes up fine. The edit boxes in the footer are there. ...
1
by: bill yeager | last post by:
I'm doing an inline edit of an Admin table using the Datagrid. There are three columns in my Admin table. I want to dynamically disable the corresponding "CareType" field (see below) in the grid...
1
by: jason | last post by:
The guts of the below asp.net vb code was pieced together from another thread - all due credit to it's original author. Thank you! I've modified it to maintain a small local Microsoft 2000...
0
by: Wyatt70 | last post by:
I'm attempting to implement a javascript popup calendar in a DataGrid. The calendar will be used to insert a date into a textbox. I keep getting a "System.NullReferenceException: Object reference...
2
by: Peter | last post by:
ASP.NET 2003 In the DataGrid how do I select current cell value in the dropdown box when I click on the edit link, currently when I click on the edit link in the DataGrid the dropdown box...
6
by: slinky | last post by:
I found the following code to transfer datagrid data to an Excel file. Is this written in C#?... I'm a vb.netter. I'm just not sure where to place the code to experiment on it. Should I place it in...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.