I wrote my own widget so that the user can select a location from the location database. This is my first ASP.net user control. Everything seemed to be working fine, but now there is a problem.
My control implements the RaisePostBackEvent function as follows:
public void RaisePostBackEvent(string eventArgument) { SelectedLocationId = eventArgument.Split('|')[0]; SelectedLocationDescription = eventArgument.Split('|')[1]; }
I wrote a test page and included the following in my ASP code:
<%= locationSelector.SelectedLocationId %>
This worked fine.
However, in my web application, the following code does not work:
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack) Response.Write(locationSelector.SelectedLocationId);
When I run this code in the debugger, I see that my "Page Load" event fires before the Post Back event! Therefore, data is not read after postback. I know that using an MS text field, text is available on the Load page, so I think I should do something wrong.
How can I find out the location that the user chose when the page load event was triggered? To clarify, I refer to the download page of the web application page.
source share