CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2005
    Posts
    1

    ASP.Net 2.0 Button click is executed twice

    Hi all,

    In ASP.Net 2.0, In page i have a command button,

    <asp:Button ID="BtnSubmit" runat="server" Text="Submit" Style="left: 458px; position: absolute; top:340px" TabIndex="6" Height="22px" OnClick="DetSubmit"/>

    On button click I am having the following code.....


    Protected Sub DetSubmit(ByVal sender As Object,ByVal e As system.EventArgs) Handles BtnSubmit.Click

    j=j+1

    End Sub

    Whe i am clicking the button the " DetSubmit" is executed twice and finally i am geting the value of j =2

    Please help me ...
    Thanks and Regards
    Sudhir

  2. #2

    Re: ASP.Net 2.0 Button click is executed twice

    Sounds like you've added the event handler for the button click twice.

  3. #3
    Join Date
    Mar 2004
    Location
    Prague, Czech Republic, EU
    Posts
    1,701

    Re: ASP.Net 2.0 Button click is executed twice

    Quote Originally Posted by mmetzger
    Sounds like you've added the event handler for the button click twice.
    Maybe.

    I guess that you add it once with OnClick="DetSubmit" and once in class definitiion in .cs. Look at your .cs source at line like BtnSubmit.OnClick += ne EventHandler(DetSubmit));
    • Make it run.
    • Make it right.
    • Make it fast.

    Don't hesitate to rate my post.

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

Featured