User Control Populate Form after Log On - newbie question

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default User Control Populate Form after Log On - newbie question

    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
    keith Guest

  2. Similar Questions and Discussions

    1. Page_Load called more than once for user control - newbie question
      Hi, I have a page with a user control as header, which in turn has a user control drop down list. When I run the page in debug with a break on...
    2. Newbie Question: User selected query
      I have a datagrid that is populated by a SQL query that is create by the user. Their is a DropDOwnList and a textbox. This gives them the WHERE...
    3. Newbie Web Service Question regarding User Controls
      Can I return a user control from a Web Service? I have a Web Page that has a Placeholder on it and I wish to populate this placeholder with a...
    4. Beginner Question - How to populate HTML form from PHP/MySQL
      I have found many examples of how to access an HTML text field from PHP, but cannot find the reverse - how to load an HTML form from a MySQL...
    5. User control newbie question - pls help
      I have a user control with a label and a method. The webform should call the method on the user control and populate the label. I am getting object...
  3. #2

    Default RE: User Control Populate Form after Log On - newbie question

    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
    keith Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139