|
-
Nov 30th, 2001, 02:42 PM
#1
Thread Starter
Junior Member
Basic Webform Question...
This, I'm sure, has a very basic answer... but I'm lost as to what it is:
I have a Web Forms page that is intended to allow a user to edit data from a textbox. I'm trying to keep as much code as possible in VB Codebehind (simply because it's there & I want to learn to use it).
When the page is initially loaded, that textbox if filled with text retrieved from a database. The user makes any changes needed to that information and clicks Submit to update it.
What happens at this point, when I call for "txtContents.text" to update my DB, is that the server is using the data that was originally loaded into the textbox during the Page_Load event, and is completely oblivious to the changes made by the client, and no update actually occurs.
What is it that I need to do to retirive the edited info out of that textbox?
-
Dec 1st, 2001, 12:53 PM
#2
New Member
Not exactly sure, but look up the IsPostBack property. It's a boolean value that tells you if the user submitted a Postback to the same page. Using this, you can bypass the form automatically retrieving the results from the DB again.
-
Dec 1st, 2001, 02:09 PM
#3
Thread Starter
Junior Member
Thanks for the reply!
Sorry... still struggling with the net stuff.
I'm tinkering with the Ispostback... but have yet to figure out how to make it shake my prob. Just as an example of what I mean:
When you set a textbox's value (say in the page_load event):
eg: textbox1.text = "HI"
The textbox is filled and the page is presented to the user.
Now let's say the user edits its contents to "GoodBye", and pressed submit.
btnSubmit_Click()
DoingSomethingWith(Textbox1.text)
End Sub
On the button click even, even though user has changed the contents of textbox1 to "GoodBye", it will ignore those changes and send "HI" instead. I'm assuming that the changes the user has made is never reported back to the server.
I've tried several variations of this on the webforms, and the result is always the same. I'm clearly overlooking something, but I don't know what it is.
-
Dec 2nd, 2001, 06:07 PM
#4
Thread Starter
Junior Member
I see...
I simply forgot to set a condition in my page_load event to load my data only if IsPostBack = false.
This is what you were trying to tell me Jim, and it flew right past me.
Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|