Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

setvalue of asp:Label with JavaScript

1 view
Skip to first unread message

Anton ml. Vahčič

unread,
Feb 12, 2004, 6:58:10 AM2/12/04
to
Hi,

Can anyone tells me how can I set value of asp:Label field with JavaScript?

Anton, ml.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.583 / Virus Database: 369 - Release Date: 10.2.2004


Anton ml. Vahčič

unread,
Feb 12, 2004, 7:16:08 AM2/12/04
to
Basically I want to get some values from client browser and use/write them
in my asp:label.

Dan

unread,
Feb 12, 2004, 10:51:43 AM2/12/04
to
How about creating a cookie using javascript and then picking this up using
your code behind?

"Anton ml. Vahčič" <anton....@campus.fri.uni-lj.si> wrote in message
news:uWFsGPW8...@TK2MSFTNGP12.phx.gbl...

Anton ml. Vahčič

unread,
Feb 12, 2004, 10:59:31 AM2/12/04
to
Hi,

That's good idea, but I don't want to have cookies behind my code... I
read somewhere that it can be done with RegisterHiddenField. I create a
hiddenfield even change value, but then how I read hidden field back to my
variable in asp.net program... Examples about it are not too perfect in MS
documentation.

Anton, ml.

"Dan" <d...@dontspam.com> wrote in message
news:u16tXAY8...@TK2MSFTNGP11.phx.gbl...

Beamer310

unread,
Feb 12, 2004, 2:45:45 PM2/12/04
to
Hello Anton,

I believe you have to something like this:

var elMyElement = document.getElementByID("ElementName");

elMyElement.innerHTML = "your text here";

Adam

"Anton ml. Vahčič" <anton....@campus.fri.uni-lj.si> wrote in message news:<u2e909V8...@TK2MSFTNGP10.phx.gbl>...

Shahar

unread,
Feb 12, 2004, 4:49:37 PM2/12/04
to
"Dan" <d...@dontspam.com> wrote in message news:<u16tXAY8...@TK2MSFTNGP11.phx.gbl>...

<form id="frmMain" method="post" runat="server">
<asp:Label ID="lbl" Runat="server"></asp:Label>
</form>


private void Page_Load(object sender, System.EventArgs e)
{
this.RegisterStartupScript("initLabel", "<script>document.all['" +
lbl.ClientID + "'].innerText='some value';</script>");
}

asif

unread,
Dec 26, 2009, 6:48:58 AM12/26/09
to

ThatsIT.net.au

unread,
Dec 26, 2009, 12:26:54 PM12/26/09
to
A label with the id "myLabel" renders as a span if the page uses master
pages the id will be changed, it will have a prefix starting with ctl00. you
need to find that Id in the source and then use it in your JavaScript to
change the spans innerText or innerHTML

to get the client id of the server control you can also use
<%=myLabel.clientId%>


"asif" <mohamedib...@gmail.com> wrote in message
news:33798b54-a79c-4348...@developmentnow.com...

0 new messages