Click to See Complete Forum and Search --> : ASP.Net 2.0 Button click is executed twice


sudhirkme@gmail.com
August 8th, 2005, 10:54 AM
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

mmetzger
August 8th, 2005, 10:59 AM
Sounds like you've added the event handler for the button click twice.

boudino
August 9th, 2005, 01:33 AM
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));