Hi,
This code produces an empty Alert window. No error.
How to get the value into the Alert window?
Thanks
Phil
aspx file (content page):
------------------------
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
asp:Label ID="Label1" runat="server"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClientClick="test()" />
<script language="javascript" type="text/javascript">
function test()
{
var x = document.getElementById('<%=label1.ClientID%>').in nerText;
alert(x)
}
</script>
</asp:Content>
code-behind:
-----------
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Label1.Text = "Alle velden moeten ingevuld zijn"
End sub 6 1381
The label has no text. I tried it - copied and pasted, exactly, except for
adding a "<" bracket in froont of the label, and adding a text property to
it. It worked just fine for me, then.
--
David Wier
MVP/ASPInsider http://aspnet101.com http://aspexpress.com
"Phil" <ss*******@fff.dfwrote in message
news:u2*************@TK2MSFTNGP06.phx.gbl...
Hi,
This code produces an empty Alert window. No error.
How to get the value into the Alert window?
Thanks
Phil
aspx file (content page):
------------------------
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
asp:Label ID="Label1" runat="server"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClientClick="test()" />
<script language="javascript" type="text/javascript">
function test()
{
var x = document.getElementById('<%=label1.ClientID%>').in nerText;
alert(x)
}
</script>
</asp:Content>
code-behind:
-----------
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Label1.Text = "Alle velden moeten ingevuld zijn"
End sub
Hi David. Thanks for repying, but i really don't understand what you mean.
Can you tell me what i have to change in my code?
Thanks
"David Wier" <da********@noSpamhotmail.comschreef in bericht
news:%2***************@TK2MSFTNGP06.phx.gbl...
The label has no text. I tried it - copied and pasted, exactly, except for
adding a "<" bracket in froont of the label, and adding a text property to
it. It worked just fine for me, then.
--
David Wier
MVP/ASPInsider http://aspnet101.com http://aspexpress.com
"Phil" <ss*******@fff.dfwrote in message
news:u2*************@TK2MSFTNGP06.phx.gbl...
>Hi,
This code produces an empty Alert window. No error. How to get the value into the Alert window?
Thanks Phil
aspx file (content page): ------------------------ <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> asp:Label ID="Label1" runat="server"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClientClick="test()" /> <script language="javascript" type="text/javascript"> function test() { var x = document.getElementById('<%=label1.ClientID%>').in nerText; alert(x) } </script> </asp:Content>
code-behind: ----------- Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Text = "Alle velden moeten ingevuld zijn" End sub
<asp:Label ID="Label1" Text="My Text is Here" runat="server"></asp:Label>
--
David Wier
MVP/ASPInsider http://aspnet101.com http://aspexpress.com
"Jan" <uu*****@fff.tywrote in message
news:u7*************@TK2MSFTNGP04.phx.gbl...
Hi David. Thanks for repying, but i really don't understand what you mean.
Can you tell me what i have to change in my code?
Thanks
"David Wier" <da********@noSpamhotmail.comschreef in bericht
news:%2***************@TK2MSFTNGP06.phx.gbl...
The label has no text. I tried it - copied and pasted, exactly, except
for
adding a "<" bracket in froont of the label, and adding a text property
to
it. It worked just fine for me, then.
--
David Wier
MVP/ASPInsider http://aspnet101.com http://aspexpress.com
"Phil" <ss*******@fff.dfwrote in message
news:u2*************@TK2MSFTNGP06.phx.gbl...
Hi,
This code produces an empty Alert window. No error.
How to get the value into the Alert window?
Thanks
Phil
aspx file (content page):
------------------------
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
asp:Label ID="Label1" runat="server"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClientClick="test()" />
<script language="javascript" type="text/javascript">
function test()
{
var x = document.getElementById('<%=label1.ClientID%>').in nerText;
alert(x)
}
</script>
</asp:Content>
code-behind:
-----------
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Label1.Text = "Alle velden moeten ingevuld zijn"
End sub
"Jan" <uu*****@fff.tywrote in message
news:u7*************@TK2MSFTNGP04.phx.gbl...
Can you tell me what i have to change in my code?
<asp:Label ID="Label1" runat="server" Text="Hello world!" />
Ok, thanks, but could you tell me why it doesn't work programmatically like
this:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click Label1.Text = "Hello World"
End sub
"Mark Rae" <ma**@markNOSPAMrae.comschreef in bericht
news:OW**************@TK2MSFTNGP05.phx.gbl...
"Jan" <uu*****@fff.tywrote in message
news:u7*************@TK2MSFTNGP04.phx.gbl...
>Can you tell me what i have to change in my code?
<asp:Label ID="Label1" runat="server" Text="Hello world!" />
It's because the ClientClick will be executed first, and at that moment, the
value is not yet put into 'text' of the label
"Phil" <uu*****@fff.tyschreef in bericht
news:%2****************@TK2MSFTNGP05.phx.gbl...
Ok, thanks, but could you tell me why it doesn't work programmatically
like this:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click Label1.Text = "Hello World"
End sub
"Mark Rae" <ma**@markNOSPAMrae.comschreef in bericht
news:OW**************@TK2MSFTNGP05.phx.gbl...
>"Jan" <uu*****@fff.tywrote in message news:u7*************@TK2MSFTNGP04.phx.gbl...
>>Can you tell me what i have to change in my code?
<asp:Label ID="Label1" runat="server" Text="Hello world!" /> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: pete |
last post by:
I found it in the view source of a corporate website.
<script Language="Javascript">
<!--
var keyMacro=
];
//-->
</script>
|
by: rked |
last post by:
I get nameSPAN1 is undefined when I place cursor in comments box..
<%@ LANGUAGE="VBScript" %>
<% DIM ipAddress
ipAddress=Request.Servervariables("REMOTE_HOST")
%>
<html>
<head>
<meta...
|
by: x muzuo |
last post by:
Hi guys,
I have got a prob of javascript form validation which just doesnt work
with my ASP code. Can any one help me out please.
Here is the code:
{////<<head>
<title>IIBO Submit Page</title>...
|
by: dli07 |
last post by:
Hello,
I'm trying to convert a piece of code that creates a dynamic vertical resizing bar in a table from internet explorer to firefox. It's based on a post from...
|
by: emily224 |
last post by:
Hello,
I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer...
|
by: emily224 |
last post by:
Hello,
I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer...
|
by: radhikams |
last post by:
Hi
I want to create a drag drop tool box using javascript... Can anyone please guide me in this regard
Thanks
|
by: knkk |
last post by:
Instead of an id getting its innerHTML changed, the entire page is getting refreshed with this function of mine (you may want to look just at the end of the function where there's an alert):
...
|
by: sva0008 |
last post by:
i have a auto suggest script that does not work in firefox , works great on IE.
/*******************************************************
AutoSuggest - a javascript automatic text input...
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: 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...
|
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...
|
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,...
|
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...
|
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...
| |