473,383 Members | 1,861 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,383 software developers and data experts.

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:OnSign(); .. OnSign() listed below ----
<table id=tblSigGrantor cellSpacing=0 cellPadding=0 border=1>

<tr>

<td>

<asp:label id="lblSigGrantor" name="lblSigGrantor"

runat="server" Width="100%" ForeColor="White"

Visible="False" BorderColor="#404040" BackColor="Red">

VIRTUAL SIGNATURE PAD FOR GRANTOR SIGNATURE

</asp:label>

</td>

</tr>

<tr>

<td>

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

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

onfocus="javascript: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="_StockProps" VALUE="0">

</OBJECT>

</td>

</tr>

</table>

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

function OnSign()

{

OnClear();

document.Form1.lblSigGrantor.Visible = true;

document.Form1.SigPlus1.TabletState = 1; //Turns tablet on

}
Nov 18 '05 #1
2 2396
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.lblSigGrantor.Visible

HTH,

Raymond Lewallen

"John Holmes" <jo****@co.skagit.wa.us> wrote in message
news:%2***************@TK2MSFTNGP12.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:OnSign(); .. OnSign() listed below ----
<table id=tblSigGrantor cellSpacing=0 cellPadding=0 border=1>

<tr>

<td>

<asp:label id="lblSigGrantor" name="lblSigGrantor"

runat="server" Width="100%" ForeColor="White"

Visible="False" BorderColor="#404040" BackColor="Red">

VIRTUAL SIGNATURE PAD FOR GRANTOR SIGNATURE

</asp:label>

</td>

</tr>

<tr>

<td>

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

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

onfocus="javascript: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="_StockProps" VALUE="0">

</OBJECT>

</td>

</tr>

</table>

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

function OnSign()

{

OnClear();

document.Form1.lblSigGrantor.Visible = true;

document.Form1.SigPlus1.TabletState = 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.Attributes.Add("style","visibility=hidden" )
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.skagit.wa.us> wrote in message
news:%2***************@TK2MSFTNGP12.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:OnSign(); .. OnSign() listed below ----
<table id=tblSigGrantor cellSpacing=0 cellPadding=0 border=1>

<tr>

<td>

<asp:label id="lblSigGrantor" name="lblSigGrantor"

runat="server" Width="100%" ForeColor="White"

Visible="False" BorderColor="#404040" BackColor="Red">

VIRTUAL SIGNATURE PAD FOR GRANTOR SIGNATURE

</asp:label>

</td>

</tr>

<tr>

<td>

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

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

onfocus="javascript: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="_StockProps" VALUE="0">

</OBJECT>

</td>

</tr>

</table>

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

function OnSign()

{

OnClear();

document.Form1.lblSigGrantor.Visible = true;

document.Form1.SigPlus1.TabletState = 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
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...
1
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...
2
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...
1
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...
4
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...
2
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...
1
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...
4
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...
1
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.