Re: Web form selected reset
Also I figured this was more of a theory question, but I can post snippets of my code if you want. Thanks.
Regards,
Jon Heese
Re: Web form selected reset
Aha, I re-found the "AutoPostBack" property in the DropDown control.
Okay, so I set "AutoPostBack" to True and now a change in that dropdown selection POSTs the form, I suppose?
This is starting to make more sense now... It's amazing what just writing out a problem will do for making it clearer.
Okay, so going off the top of my head:
First of all, I've not yet put a Submit button on the form yet, so I haven't even started dealing with how form submissions will be handled. But now it seems as though this dropdown is a sort of submit button in itself when AutoPostBack is turned on. So should I figure out how to handle a submit (i.e. differentiate a POST from a GET) and then differentiate between the "Submit" button (which hasn't been created yet, but will be) and the dropdown's AutoPostBack? I suppose that will keep the PageLoad event from firing?
Please forgive me, but I'm learning as I go, so I don't actually know how to do most of this stuff in practice yet, so I'm kinda talking abstractly here. I've worked on Java Servlets and JSP forms for years, but VB and .NET are new to me.
Regards,
Jon Heese
Re: Web form selected reset
Aha, "IsPostBack" is exactly what I was looking for.
Okay, problem solved.
I put a "If Not IsPostBack Then" at the top of the PageLoad sub and now my form behaves exactly as I want. Thanks for all the help... me. =)
Regards,
Jon Heese
Re: Web form selected reset
For your dropdown problem, what's happening currently is that the page_load event gets fired every time, and repopulates your dropdown list. You should place the code for populating the dropdownlist in an if block like this:
VB Code:
If Not Page.IsPostBack Then
'Populate dropdownlist
End If
That'll do wonders ;)