I believe the following link will help you with your sequence issue:
http://msdn.microsoft.com/library/de...nLifecycle.asp
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Veerle" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I have an aspx page with a dropdownlist and a button:
> <form id="Form1" method="post" runat="server">
> <div>
> <asp:label id="Label1" runat="server">Startdate: </asp:label>
> <asp:dropdownlist id="DateList" runat="server"
> OnLoad="LoadDates"></asp:dropdownlist>
> </div>
> <div>
> <asp:Button id="BtnBewaren" runat="server" Text="Bewaren"
> OnClick="SaveForm"></asp:Button>
> </div>
> </form>
>
> Every time the page is loaded, I fill the dropdownlist with items in
> the method LoadDates. When the button is clicked, then the method
> SaveForm is executed which saves the value of the currently selected
> item in the dropdownlist in a cookie.
>
> What I would like to do, is adjust the LoadDates method, so that at
> the end of it, the selected item is set to the value of the cookie.
> But appearantly, the LoadDates method is always executed before the
> SaveForm method. So when I change the selected item at the end of the
> LoadDates method, then the selected item is set to the previous value,
> not the new one.
>
> Is there a way to make sure that the SaveForm method is executed
> before the LoadDates method? Or is there a way to check in the
> LoadDates method, that the page was loaded without clicking the
> button?