Changing web control values from Javascript

M

Marcus

Hi,

I have a small piece of Javascript that executes when the Onclick
event of an ASP.NET button is clicked and then finally changes the
text value of an asp.net button control as follows:-

document.getElementById("Button1").text = "Canceled";

However, when I get back to the form load event for this page (when it
gets posted) and inspect Button1.text it shows me the buttons original
value and not what the Javascript code has changed it to. The funny
thing is that it works with an ASP.NET text box.

Can anyone give me some idea as to what is happening...?

Regards,

Marcus Wade.
 
Joined
Nov 3, 2006
Messages
3
Reaction score
0
1. make the access specifier of the control to public.
2. specify it like this

document.getElementById("<%==>").text = "Canceled";

try this buddy
 
Joined
Nov 3, 2006
Messages
3
Reaction score
0
Check this out

1. make the access specifier of the control to public.
2. specify it like this

document.getElementById("<%==>").text = "Canceled";

try this buddy
 
Joined
Nov 3, 2006
Messages
3
Reaction score
0
1. make the access specifier of the control to public.

2. specify it like this



document.getElementById("<%=Button1.ClientID=>").text = "Canceled";


This will help you
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top