473,779 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

asp:label control doesn't show up as a form element

I would like to turn on a label control in javascript with the onfocus event
of another control by setting the Visible property to true. When I try and
reference this label control it says "Microsoft JScript runtime error:
'document.Form1 .lblSigGrantor' is null or not an object". I wrote a loop and
iterated through the elements for the form and this control doesn't show up.
Code listed below, please help.

Thanks,

John Holmes

---------- html code, the onfocus event of the OBJECT tag calls
javascript:OnSi gn(); .. OnSign() listed below ----
<table id=tblSigGranto r cellSpacing=0 cellPadding=0 border=1>

<tr>

<td>

<asp:label id="lblSigGrant or" name="lblSigGra ntor"

runat="server" Width="100%" ForeColor="Whit e"

Visible="False" BorderColor="#4 04040" BackColor="Red" >

VIRTUAL SIGNATURE PAD FOR GRANTOR SIGNATURE

</asp:label>

</td>

</tr>

<tr>

<td>

<OBJECT id=SigPlus1 onblur="OnSave( 'XYZ','txtSigGr antor');"

style="LEFT: 0px; WIDTH: 320px; TOP: 0px; HEIGHT: 180px"

onfocus="javasc ript:OnSign();" height="75"

classid="clsid: 69A40DA3-4D42-11D0-86B0-0000C025864A" name="SigPlus1"

VIEWASTEXT>

<PARAM NAME="_Version" VALUE="131095">

<PARAM NAME="_ExtentX" VALUE="4842">

<PARAM NAME="_ExtentY" VALUE="1323">

<PARAM NAME="_StockPro ps" VALUE="0">

</OBJECT>

</td>

</tr>

</table>

-------------------------------- OnSign(); ... javascript code
.....----------

function OnSign()

{

OnClear();

document.Form1. lblSigGrantor.V isible = true;

document.Form1. SigPlus1.Tablet State = 1; //Turns tablet on

}
Nov 18 '05 #1
2 2428
John,

Labels are not form elements, they are more directly document elements.
They convert to SPAN tags in HTML code, which are not attributues of a form
object. Lose the Form1. document.lblSig Grantor.Visible

HTH,

Raymond Lewallen

"John Holmes" <jo****@co.skag it.wa.us> wrote in message
news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
I would like to turn on a label control in javascript with the onfocus event of another control by setting the Visible property to true. When I try and
reference this label control it says "Microsoft JScript runtime error:
'document.Form1 .lblSigGrantor' is null or not an object". I wrote a loop and iterated through the elements for the form and this control doesn't show up. Code listed below, please help.

Thanks,

John Holmes

---------- html code, the onfocus event of the OBJECT tag calls
javascript:OnSi gn(); .. OnSign() listed below ----
<table id=tblSigGranto r cellSpacing=0 cellPadding=0 border=1>

<tr>

<td>

<asp:label id="lblSigGrant or" name="lblSigGra ntor"

runat="server" Width="100%" ForeColor="Whit e"

Visible="False" BorderColor="#4 04040" BackColor="Red" >

VIRTUAL SIGNATURE PAD FOR GRANTOR SIGNATURE

</asp:label>

</td>

</tr>

<tr>

<td>

<OBJECT id=SigPlus1 onblur="OnSave( 'XYZ','txtSigGr antor');"

style="LEFT: 0px; WIDTH: 320px; TOP: 0px; HEIGHT: 180px"

onfocus="javasc ript:OnSign();" height="75"

classid="clsid: 69A40DA3-4D42-11D0-86B0-0000C025864A" name="SigPlus1"

VIEWASTEXT>

<PARAM NAME="_Version" VALUE="131095">

<PARAM NAME="_ExtentX" VALUE="4842">

<PARAM NAME="_ExtentY" VALUE="1323">

<PARAM NAME="_StockPro ps" VALUE="0">

</OBJECT>

</td>

</tr>

</table>

-------------------------------- OnSign(); ... javascript code
....----------

function OnSign()

{

OnClear();

document.Form1. lblSigGrantor.V isible = true;

document.Form1. SigPlus1.Tablet State = 1; //Turns tablet on

}

Nov 18 '05 #2
When a control's Visible property is set to False on the server, the HTML
for that control is not sent down at all. Since it isn't sent down - there
is no way to make it visible, since it doesn't exist.

You would have to do something like:
myLabel.Attribu tes.Add("style" ,"visibility=hi dden")
on the server, to set the visibility to hidden. Then, in javascript, you
would set it back to visible or whatever it is.

"John Holmes" <jo****@co.skag it.wa.us> wrote in message
news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
I would like to turn on a label control in javascript with the onfocus event of another control by setting the Visible property to true. When I try and
reference this label control it says "Microsoft JScript runtime error:
'document.Form1 .lblSigGrantor' is null or not an object". I wrote a loop and iterated through the elements for the form and this control doesn't show up. Code listed below, please help.

Thanks,

John Holmes

---------- html code, the onfocus event of the OBJECT tag calls
javascript:OnSi gn(); .. OnSign() listed below ----
<table id=tblSigGranto r cellSpacing=0 cellPadding=0 border=1>

<tr>

<td>

<asp:label id="lblSigGrant or" name="lblSigGra ntor"

runat="server" Width="100%" ForeColor="Whit e"

Visible="False" BorderColor="#4 04040" BackColor="Red" >

VIRTUAL SIGNATURE PAD FOR GRANTOR SIGNATURE

</asp:label>

</td>

</tr>

<tr>

<td>

<OBJECT id=SigPlus1 onblur="OnSave( 'XYZ','txtSigGr antor');"

style="LEFT: 0px; WIDTH: 320px; TOP: 0px; HEIGHT: 180px"

onfocus="javasc ript:OnSign();" height="75"

classid="clsid: 69A40DA3-4D42-11D0-86B0-0000C025864A" name="SigPlus1"

VIEWASTEXT>

<PARAM NAME="_Version" VALUE="131095">

<PARAM NAME="_ExtentX" VALUE="4842">

<PARAM NAME="_ExtentY" VALUE="1323">

<PARAM NAME="_StockPro ps" VALUE="0">

</OBJECT>

</td>

</tr>

</table>

-------------------------------- OnSign(); ... javascript code
....----------

function OnSign()

{

OnClear();

document.Form1. lblSigGrantor.V isible = true;

document.Form1. SigPlus1.Tablet State = 1; //Turns tablet on

}

Nov 18 '05 #3

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

Similar topics

10
31694
by: Dwizz | last post by:
Hello, I really hope that someone can help me resolve my problem, I've been working on it for the past few days, to no avail. I have an asp:label which gets its value from the database, but what I'm trying to do is to get that value (from the asp:label) and place it inside the javascript input value. I can post sample code if required.
1
11446
by: moondaddy | last post by:
I want to use a asp Label control (or a <div runat=server> element) in a template column of a datagrid. In the code behind in the grid's ItemDataBound event I need to dynamically set the innerHTML of this control with data and line breaks (<br>). The problem is that while working in the code behind, I don't see any properties for this control where I can set innerHTML, only text. Any good ideas?
2
461
by: John Holmes | last post by:
I would like to turn on a label control in javascript with the onfocus event of another control by setting the Visible property to true. When I try and reference this label control it says "Microsoft JScript runtime error: 'document.Form1.lblSigGrantor' is null or not an object". I wrote a loop and iterated through the elements for the form and this control doesn't show up. Code listed below, please help. Thanks, John Holmes
1
1469
by: Ray Cacciatore | last post by:
I'm using an asp:label to display source code on my web page. The source code is formatted with carriage returns, tabs and spaces. In the past, all I had to do was wrap the label in a <pre> element and it was fine. But this time, when I wrap my asp:label inside a <pre> element, it's only recognizing the carriage returns but not the tabs or spaces. When I view the source code in NotePad, everything is properly formatted. So how do I...
4
1969
by: Jeronimo Bertran | last post by:
I am currently using databing to show on an asp:label the result of appending two database fields in the following way: <asp:label id=textAcknowledgedBy runat="server" Text='<%# DataBinder.Eval (dataSetEventResponse1, "Tables.DefaultView..UserName") + " from " + DataBinder.Eval(dataSetEventResponse1, "Tables .DefaultView..ComputerName") %>'></asp:label>
2
1756
by: Peter Rilling | last post by:
Below is some code that I do not know why it does not work. Okay, as you can see it is simple HTML with two ASP:Label controls. Each label has some code that basically gets a string that will be written to the browser. ConditionalText.Eval is a method from my own library. As you can see, I have written some static text before and after the first Eval call. If I open this page, I get no content in the Label, even the static content. I...
1
9230
by: nospamjac | last post by:
Hi, Is there a way to update the text of an asp:label on a webform without refreshing the entire page? What is called by button clicks and other events that refresh a webform control? See the example WebForm1.aspx and WebForm1.aspx.cs code below: WebForm1.aspx =======================================================
4
6716
by: pagates | last post by:
Hello All-- I have a number of <asp:Label CssClass="someclass">Text</asp:Labelcontrols on my page. I would like them to be shown as <div class="someclass">Text</div> rather than <span class="someclass">Text</span> When it uses a span, it doesn't seem to use all the class definitions, particularly for margins and positioning.
1
2797
by: Steve Hershoff | last post by:
I'm using VS 2003, and need to extract the text from an asp label in my code-behind file. The label is part of a DataList's ItemTemplate. I've noticed that in my ascx file (we're using User Controls here) I can't set the Text property in the opening tag when writing out the <asp:Label....</asp:Labeltags. I have to put my text between the opening and closing tags, like you would with a regular HTML tag. So this might be the cause of...
0
9632
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
10302
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10071
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
9925
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...
1
7478
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5372
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
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3631
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.