Results 1 to 5 of 5

Thread: Buttons on webforms

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2002
    Location
    Netherlands
    Posts
    39

    Unhappy Buttons on webforms

    Does anybody have an idea why my webapplication requires 2 clicks before the application goes to the code behind the click???? It drives me crazy!

    Whenever I click my button just once, it goes thru the page_load twice and displays my page initialized...
    Last edited by Dozo_1st; Aug 22nd, 2002 at 06:54 AM.

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    lets see you aspx and code behind code.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2002
    Location
    Netherlands
    Posts
    39

    code behind code

    I have found the evildoer in my code:

    I have a checkboxlist which is filled with items during runtime with the following code:

    Code:
         Private Function Show_Producten()
            chklstDiensten.Items.Clear()
            drArray = LAWSysteem.DBInterface.dsSelectProducten.Select(Nothing, Nothing, DataViewRowState.CurrentRows)
            If drArray.Length > 0 Then
                For i = 0 To (drArray.Length - 1)
                    chklstDiensten.Items.Add(drArray(i)("ProdNaam"))
                    chklstDiensten.Items(i).Text = drArray(i)("ProdNaam").ToString
                Next
            End If
            Vul_Diensten()
        End Function
    Now, whenever I do something (which is either manually or automated in runtime checking and unchecking) with this checkboxlist, any button I click after this checking and unchecking will cause a reload of the page in initialized state with the properties in the same state as the form in designtime; so no checkboxlist present at all (because items = -1) and all my textboxes are empty again. To go to the code of the clicked button I need to click the button again....

    I don't know how it is possible by checking and unchecking my total webform can initialize

    Most important: how do I solve this?

    Anyone ideas?

    thanks in advance for your help...
    Dozo
    Last edited by Dozo_1st; Aug 22nd, 2002 at 06:51 AM.

  4. #4

    Thread Starter
    Member
    Join Date
    Aug 2002
    Location
    Netherlands
    Posts
    39

    Unhappy anyone please?

    Does anyone know the answer????

  5. #5

    Thread Starter
    Member
    Join Date
    Aug 2002
    Location
    Netherlands
    Posts
    39

    Cool The answer has been found...

    by myself...

    The problem was that the checkboxlist was built and rendered at the client. Therefore any action that involved using the checkboxlist was done at the client and rendered at the client again, while everything as was set to runat="server".

    To get rid of this problem I had to set Postback = True for the checkboxlist and it just worked fine after that!!!!

    So there you go....

    Dozo

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