textbox value lost upon postback

A

Ashish

Hi All,
I have a server runnable textbox control. I also have a server side button
object but I hook up javascript to it to show a modal dialog. Upon return it
places the value in the textbox (client side script). The problem is that
after it places the value, postback occurs and value is lost. I have tried
overriding SaveViewState and LoadViewState but it doesnt help (for some
super cool reason load is called first after postback rather than save view
state. however since the value of textbox is changed on client side it
doesnt help at all). Next I tried implementing IPostBackDataHandler and
IPostBackEventHandler events but the methods arent' called at all. Help !!!
I wanna prevent silly workouts of a hidden field if possible.
Thanks
Ashish
 
G

Guest

The problem is the serverside button. It automatically starts a postback when you click it. You can change the value of the control on the client-side via JavaScript and then submit the form and pick up the new value on the server, its something I do all the time. If you show the form modally ther is a problem that when the page that is the modal popup page is submitted it actually submits the parent window rather than the current window. This might also be causing the problem. To open the popup windiw try using a standard html button rather than a webforms button. Also, try not opening the new window modally and see if that helps.

James :)

----- Ashish wrote: -----

Hi All,
I have a server runnable textbox control. I also have a server side button
object but I hook up javascript to it to show a modal dialog. Upon return it
places the value in the textbox (client side script). The problem is that
after it places the value, postback occurs and value is lost. I have tried
overriding SaveViewState and LoadViewState but it doesnt help (for some
super cool reason load is called first after postback rather than save view
state. however since the value of textbox is changed on client side it
doesnt help at all). Next I tried implementing IPostBackDataHandler and
IPostBackEventHandler events but the methods arent' called at all. Help !!!
I wanna prevent silly workouts of a hidden field if possible.
Thanks
Ashish
 
A

Ashish

I tried javascript postback while using server button and it doesnt work. I
tried modalless window.open mechanism with server control again it doesnt
work. Can u gimme an example of how u do it ?
Thanks
Ashish

James Culshaw said:
The problem is the serverside button. It automatically starts a postback
when you click it. You can change the value of the control on the
client-side via JavaScript and then submit the form and pick up the new
value on the server, its something I do all the time. If you show the form
modally ther is a problem that when the page that is the modal popup page is
submitted it actually submits the parent window rather than the current
window. This might also be causing the problem. To open the popup windiw try
using a standard html button rather than a webforms button. Also, try not
opening the new window modally and see if that helps.
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top