Results 1 to 5 of 5

Thread: page load event

  1. #1

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075

    page load event

    this is in ASP.NET...but I'm using the codebehind page which is VB.NET

    in the codebehind page I placed some code to fill my combo box, sorry that was 6.0 talk, my dropdownlist. Heres the code I'm using and it's the only code I have in the page load event.

    Me.DropDownList1.Items.Add(New ListItem("Database1", "D"))
    Me.DropDownList1.Items.Add(New ListItem("Database2", "P")

    When I run my page I get double data in my dropdownlist from each line of code. I went into debug mode and it is in fact going through the code twice. It's goes to the end sub and then goes back to page_load and runs the same code again. Any reason why it's going through this procedure twice?

    thanks,
    eye

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Try testing for postback:
    VB Code:
    1. If Not Me.Postback() Then
    2.    Me.DropDownList1.Items.Add(New ListItem("Database1", "D"))
    3.    Me.DropDownList1.Items.Add(New ListItem("Database2", "P")
    4. End If

  3. #3

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    I'm trying to use the postback method and I'm getting an error that it's not a member of my app..

    If Not Me.Postback() Then
    Me.DropDownList1.Items.Add(New ListItem("Database1", "D"))
    Me.DropDownList1.Items.Add(New ListItem("Database2", "P")
    End If

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Sorry its actually IsPostBack.

  5. #5

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    postback stays false and it still goes through the code twice.

    Anyone know why it would go through the page load code twice?

Posting Permissions

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



Click Here to Expand Forum to Full Width