473,387 Members | 1,569 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,387 software developers and data experts.

Funny Behaviour -- Probably Easily Answered

Ron
I am trying to gather data from various textboxes in a webform. Upon
loading, the form populates itself with values from a database. When the
Update button is pressed, the new values are loaded into an array and passed
to the data object.

The strange part is that when I pull the newly edited values from the
textboxes, the original values stick around. For example, I can change a
products name from "Fish Bait" to "Cat Food"... when I hit update, the value
will revert back to "Fish Bait".

I don't really know what the deal is, any suggestions?
Nov 17 '05 #1
2 1343
Ron
Ahh, I knew it had to be something with the postback.

Thanks a lot, I appreciate your help

Ron
"Chris R. Timmons" <crtimmons@X_NOSPAM_Xcrtimmonsinc.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
"Ron" <ro*@razorvision.net> wrote in
news:bd********@library2.airnews.net:
I am trying to gather data from various textboxes in a webform.
Upon loading, the form populates itself with values from a
database. When the Update button is pressed, the new values are
loaded into an array and passed to the data object.

The strange part is that when I pull the newly edited values
from the textboxes, the original values stick around. For
example, I can change a products name from "Fish Bait" to "Cat
Food"... when I hit update, the value will revert back to "Fish
Bait".

I don't really know what the deal is, any suggestions?


Ron,

It sounds like you may be incorrectly populating the textboxes in the
Page_Load event.

The standard way to do this is inside an "if (!this.IsPostBack)"
block:

if (!this.IsPostBack)
{
// Populate controls here.
}

If this isn't done, the controls will be repopulated every time the
page is called.

Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/

Nov 17 '05 #2
I am guessing something about your code that might or might not be correct.

page_load
{
//populate text boxes from data base
}

update_click()
{
//put the new values into the database.
}

If this is the case, then when you click the update button, page_load runs
FIRST so they old values would be put into the textboxes from the database.

now when the update happens, the values might be the original values, since
you assigned them.

try putting your //populate textboxes from data base int

page_load
{
if ( !Page.IsPostBack )
{
//populate textboxes from data base.
}
}

This should fix all your problems, if it doesn't let me know.

HTH,

bill
"Ron" <ro*@razorvision.net> wrote in message
news:bd********@library2.airnews.net...
I am trying to gather data from various textboxes in a webform. Upon
loading, the form populates itself with values from a database. When the
Update button is pressed, the new values are loaded into an array and passed to the data object.

The strange part is that when I pull the newly edited values from the
textboxes, the original values stick around. For example, I can change a
products name from "Fish Bait" to "Cat Food"... when I hit update, the value will revert back to "Fish Bait".

I don't really know what the deal is, any suggestions?

Nov 17 '05 #3

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

Similar topics

1
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
8
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
92
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption?...
65
by: perseus | last post by:
I think that everyone who told me that my question is irrelevant, in particular Mr. David White, is being absolutely ridiculous. Obviously, most of you up here behave like the owners of the C++...
5
by: Matt | last post by:
I wrote the tcp socket client-server program that the server will echo the message received from the client. In client program: char sendBuf; while(1) { cout << "Enter message:";...
5
by: eScrewDotCom | last post by:
www.eScrew.com eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is...
8
by: MarsFossils | last post by:
I am giving a lunch and learn talk on how to "Create your own Web Page" tomorrow and would like to mention a funny anecdote with an inspiring moral about web page design. Does anybody have any...
0
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
9
by: mstilli | last post by:
Hi, I am trying to use schema for server side validation using xerces to catch the validation errors. validating this XML: <Content4> <textarea13></textarea13>...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.