473,396 Members | 2,010 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,396 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 4974
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.