Ask a Question related to ASP.NET General, Design and Development.
-
Ron #1
Funny Behaviour -- Probably Easily Answered
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 Guest
-
already answered in crosspost
Please do NOT start crossposting. John -- ---------------------------------------------------------------------------- ----------- RESOURCES... -
Funny behaviour of perfstat_disk()...
On a customers machine, the function call: ndisks = perfstat_disk(NULL, NULL, sizeof(perfstat_disk_t), 0); has started returning bogus data, i.e.... -
Design Question -- DataList, Probably Easily Answered
Hi Ron, Check out this article: http://www.developer.com/net/asp/article.php/2215041 I think it will get you going in the right direction. ... -
Easily answered firewire hub question
No, my hardrive works fine. No, OS X didn't mysteriously crash. No, I don't need help with buggy software. I love my 15" Powerbook and it... -
funny printf behaviour in need of explanation
Hi, i am attaching a snippet of code and two results that it produces. the first result is when the printf line is not commented out while the... -
Ron #2
Re: Funny Behaviour -- Probably Easily Answered
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:Xns93A59ADBC2733crtimmonscrtimmonsin@207.46.2 48.16...> "Ron" <ron@razorvision.net> wrote in
> news:bdcq38$9an@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.
> [url]http://www.crtimmonsinc.com/[/url]
Ron Guest
-
William F. Robertson, Jr. #3
Re: Funny Behaviour -- Probably Easily Answered
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" <ron@razorvision.net> wrote in message
news:bdcq38$9an@library2.airnews.net...passed> 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 andvalue> 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> will revert back to "Fish Bait".
>
> I don't really know what the deal is, any suggestions?
>
>
William F. Robertson, Jr. Guest



Reply With Quote

