Help needed ASAP! (Click events, panels, and Page Postbacks)

Discussion in 'ASP.NET / ASP.NET Core' started by Karen, May 30, 2005.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. This is sort of a continuation of a thread I posted a few days ago....

    I'm building an application form that has (had) several pages. At someone's suggestion, I have switched to having a single page that has several panels instead. I'm using this format because it is an easy way to retain the information the user fills out on the application. When the page first loads, Panel #1 is visible and the others are not. Each page has a "Continue" button. I had put the code to make each new panel visible in the click event of each button. So, Panel2.Visible = "True" (with all other panels being false) in the click event of the button on Panel1. Then, Panel3.Visible = "True" in the click event of the button in Panel2.

    I think I've discovered that this code really needs to be in the page_load event. So,in the Page_Load I have...

    IfNot Page.IsPostBack Then
    Panel1.Visible = "True"
    Panel2.Visible = "False"
    Panel3.Visible = "False"
    End If
    If Page.IsPostBack Then
    Panel2.Visible = "True"
    Panel1.Visible = "False"
    Panel3.Visible = "False"
    End If

    This works really well for the first click. But, I have a 10 page (panel) form. How do I make each subsequent bring up a different panel?

    I was thinking that I could do a count somehow (If Page.IsPostback = "2"), but I'm not sure if that's valid....

    Any help anyone could give me would be greatly appreciated! I'm stuck, and on a tight deadline!

    Thanks a million!

    ~Steph
     
  2.  
  3. Thank you so much for replying Scott! This looks like what I need.


    When I try the code, however, it throws an exception and says that
    "Object reference not set to an instance of an object."
    when referring to pan.Visible = False.


    What am I missing?


    ~Steph
     
  4. Steph,

    I just tried the following skeleton code and it worked without error.

     
  5. Thanks a million, Scott! You're my hero. :eek:)
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page