473,287 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

textbox value lost upon postback

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
Nov 18 '05 #1
2 4966
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

Nov 18 '05 #2
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" <Ja****@dumgal.gov.uk> wrote in message
news:0F**********************************@microsof t.com...
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

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Celine | last post by:
I have a webform with multiple panels with textboxes, dropdownlists, radiobuttonlists, etc. The user navigates through the panels and then submits the information at the end. The first panel...
2
by: Raed Sawalha | last post by:
Hi, This is probably pretty simple but... I am dynamically adding rows to a HtmlTable that contain Textbox controls. (There may be more than one server control/textbox in a given cell) How...
10
by: Jeff | last post by:
Is there a workaround for datagrid contents being lost on postback? All other controls persist. It's just datagrids that appear to be reinitialized. It doesn't make sense to continually rebuild...
2
by: Atreju | last post by:
Ok I got form within a c sharp page. Situation: On the form I have a drop downliwst and a textbox, the dropdownlist is populated with products and the textbox has a default vale of the product...
1
by: Tom S. | last post by:
Hello all, I have a page that contains two listboxes and an "Add" button. When clicked, the button fires javascript that moves the selected item(s) in the first listbox to the second listbox and...
2
by: John Kotuby | last post by:
Hi guys, I am converting a rather complicated database driven Web application from classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The original ASP application works quite...
4
by: Mario Vargas | last post by:
Hello all, I am trying to dynamically add elements to a select list (which is running on the server, runat="server") with JavaScript, but when I postback, the new elements are lost. I'm not sure...
0
by: sejal17 | last post by:
Hello Everyone, My application is touch srceen aplication( in ASP.NET with C#). i have done here is that ,i m adding products in shopping cart with dafault product quantity one.here i...
10
by: pt36 | last post by:
Hi I have a page with a form and a textbox. before to submit the form I want to chek if the inserted value in the textbox is already present in a database. So I need to pass the textbox value...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.