User Control Populate Form after Log On - newbie question

K

keith

Hi,

I have a user control that contains a login element, textboxes for username
and password, and a button to submit, which appears in the header of each
page in my asp.net application. All of the below is done with code behind.

When the user correctly logs on, it sets a public property bLoggedOn to true
and makes the text boxes enabled = false.

This works fine across all the pages in the application.

However, some pages have a form where the user can change their data. I
populate these in the onload event for the page, if the user control's
bLoggedOn is true. ( I use a session variable to maintain this across the
pages)

However, if I log on while on one of these pages, the form does not populate.

I have a reset button that clears the form if not logged on, or repopulates
it with the original data if logged on, which works fine. Pressing the page
link in the header (calling itself) works.

Logging on via the user control calls the page_onload, but it happens before
the user control checks the log on information and sets it's bLoggedOn
property to true. (I set break points to confirm this)

Is there an event on the page that I can use to populate the form after
loggin in via the user control?

here's what doesn't work:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Header1.pLoggedIn Then
loadForm()
End If
End Sub

As I said, Load Form works if we enter the page logged on, or press the
refresh button on that page.

Thanks,

Keith
 
K

keith

To answer my own question:

In the user control I created an event
Public Event eLoggedIn()

and raised it when I had a confirmed log on:
RaiseEvent eLoggedIn()

which I could then handle on the Page.

Keith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top