Mefisto
Mefisto

Reputation: 19

vb.net button click event not firing first time

I have a very simple Textbox and Button, but Button click event not firing at first time ( only firing in second click)

<asp:TextBox ID="TxtSurvey" runat="server"></asp:TextBox> <br />
<asp:Button  ID="BtnGoSurvey" runat="server" Text="LetsGo"/>

The code is very simple too

 Protected Sub BtnGoSurvey_Click(sender As Object, e As EventArgs) Handles BtnGoSurvey.Click
        Session("IDSurvey") = TxtSurvey.Text
        BtnGoSurvey.PostBackUrl = "~/Survey.aspx"
End Sub

What i'm doing wrong ? Thanks for help

Upvotes: 0

Views: 796

Answers (1)

Sami
Sami

Reputation: 3800

If you can use Response.Redirect, then following is supposed to work:

Protected Sub BtnGoSurvey_Click(sender As Object, e As EventArgs) Handles BtnGoSurvey.Click
    Session("IDSurvey") = TxtSurvey.Text
    Response.Redirect("~/Survey.aspx",True)
End Sub

Upvotes: 1

Related Questions