473,626 Members | 3,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid invisible Label/Textbox does not generate HTML Object?

Hi, All:

I have a datagrid with TemplateColumn as following:

<asp:TemplateCo lumn Visible="False" >
<ItemStyle Width="0px"></ItemStyle>
<ItemTemplate >
<asp:Label id="lblMin_Valu e" Visible=False runat="server" Text='<%#
DataBinder.Eval (Container, "DataItem.min_v alue") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateCol umn>

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 2883

Add a hidden object.

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

something like that.

"rockdale" <ro************ @gmail.com> wrote in message
news:11******** ************@j5 5g2000cwa.googl egroups.com...
Hi, All:

I have a datagrid with TemplateColumn as following:

<asp:TemplateCo lumn Visible="False" >
<ItemStyle Width="0px"></ItemStyle>
<ItemTemplate >
<asp:Label id="lblMin_Valu e" Visible=False runat="server" Text='<%#
DataBinder.Eval (Container, "DataItem.min_v alue") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateCol umn>

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:TemplateCo lumn Visible="False" >
<ItemStyle Width="0px"></ItemStyle>
<ItemTemplate >
<asp:Label id="lblMin_Valu e" Visible=False runat="server" Text='<%#
DataBinder.Eval (Container, "DataItem.min_v alue") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateCol umn>

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_Valu e" CssClass="invis ible" 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:TemplateCo lumn ItemStyle-CssClass="invis ible"
FooterStyle-CssClass="invis ible" HeaderStyle-CssClass="invis ible"
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:TemplateCo lumn Visible="False" >
<ItemStyle Width="0px"></ItemStyle>
<ItemTemplate >
<asp:Label id="lblMin_Valu e" Visible=False runat="server" Text='<%#
DataBinder.Eval (Container, "DataItem.min_v alue") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateCol umn>

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_Valu e" CssClass="invis ible" 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
2429
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 columns, and adds a delete buttoncolumn and editcommandcolumn. Below that, I have several text boxes with a button with an onclick event to add new information to the database table the grid pulls from. A)Select Info binds fine.
6
464
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 procedure. That works fine the data is requeried and the new results are displayed in the datagrid and the reversebind works for saving the information. However if I add another text box or dropdown box it does not seem to requery correctly. If...
12
2866
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 text into a stream in order to be able to use DataSetOutcomes1.ReadXML(MyStream). Thanks in advance, James
1
1670
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. But when I press the "insert" link, it never seems to go to the DataGrid1_ItemCommand routine. ************************************************************************************** <%@ Page Language="vb" trace="true" debug="true" %> <%@ Import...
1
1687
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 if the record is part of an existing relationship, so the user can't update it. The "CareTypeID" field is the key and is invisible to the user. Here is the db table columns: CareTypeID
1
1532
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 access DB via a datagrid control. The add and delete functions work great, but the edit does not actually update the database. I put in some displays and apparently on the first item in the grid gets set during editing, all others come back empty???
0
4014
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 not set to an instance of an object" error, which points to the following line: lnkCalendar.Attributes("OnClick") = String.Format("window.open('Calendar.aspx?textbox={0}','cal','...')", txtEstimatedDeploy) Here is the complete code for the...
2
2845
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 appears in the cell, but allways the first item in the dropdown box is shown not the current cell value? How do I make the current value in the cell automaticaly be selected in the dropdown box.
6
2730
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 the event handler for a form button. Is there other ways to accomplish this? I looked at some on the web and usergroups, but was confused as to the functioning. BTW my datagrid is enclosed in a <div></divfor ease of scrolling if that would...
0
8268
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8202
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8641
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8366
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8510
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7199
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4202
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2628
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.