Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 how do we display a value in client side

Author  Topic 

rtutus
Aged Yak Warrior

522 Posts

Posted - 2006-10-10 : 20:55:38
hi,
if we have a variable in a javascript function. how do we display in the aspx:
do we just put its name like here after a label for example.

<asp:label text="value from javascript" runat=server> myJavascriptValue </label>

or what s the syntax exactly
thank you

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2006-10-10 : 21:49:27
javascript has nothing to do with server-side asp.net code ... you do it client-side with javascript:

<script type='text/javascript'>
var myValue='test';
document.write(myValue);
</script>

or if you have a DIV or SPAN element on your page with a specific ID, you can set the InnerHTML property:

<script type='text/javascript'>
var myValue='test';
document.getElementById('someID').innerHTML = myValue;
</script>


If that doesn't help you, please provide more specific information with a simple example explaining precisely what you are trying to do so that we can quickly help you without having to guess as to exactly what you need.


- Jeff
Go to Top of Page

rtutus
Aged Yak Warrior

522 Posts

Posted - 2006-10-11 : 16:13:40
Ok so we have to either have a span or something or use dosument.write

i thoght we could diplay a variable just like that
Thanks
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2006-10-11 : 16:30:45
This is my last guess as to what you want .... Are you trying to display a message box or something?

<script type='text/javascript'>
alert(myValue);
</script>

Again:

If that doesn't help you, please provide more specific information with a simple example explaining precisely what you are trying to do so that we can quickly help you without having to guess as to exactly what you need.


- Jeff
Go to Top of Page

rtutus
Aged Yak Warrior

522 Posts

Posted - 2006-10-20 : 08:48:15
Thanks Jeff. You answered perfectly my questions.
Go to Top of Page
   

- Advertisement -