LinkButton click event not firing

Discussion in 'ASP .Net' started by Mel, Jun 11, 2007.

  1. Mel

    Mel Guest

    I have a website that allows the user to generate a new quote. When
    they are finished creating the quote, it brings them to the final page
    (called the Goodbye.aspx page) which just states the quote has been
    submitted and an email will arrive to them shortly.

    I added a "Home" link button on this page which will return them to
    the website's home page. I want to clear out 10 session variables
    (contact name, ship to address, city, state, zip, etc.) when they
    click the Home button so it's ready for a new quote, however the
    LinkButton_click event is never fired. How do I clear the session
    variables from this Goodbye page?
     
    Mel, Jun 11, 2007
    #1
    1. Advertising

  2. On Jun 11, 10:35 pm, Mel <> wrote:
    > I have a website that allows the user to generate a new quote. When
    > they are finished creating the quote, it brings them to the final page
    > (called the Goodbye.aspx page) which just states the quote has been
    > submitted and an email will arrive to them shortly.
    >
    > I added a "Home" link button on this page which will return them to
    > the website's home page. I want to clear out 10 session variables
    > (contact name, ship to address, city, state, zip, etc.) when they
    > click the Home button so it's ready for a new quote, however the
    > LinkButton_click event is never fired. How do I clear the session
    > variables from this Goodbye page?


    How does your button look like?

    Should be similar to this

    <asp:LinkButton ID="..." Text="Home" runat="server"
    OnClick="LinkButton_click"></asp:LinkButton>

    and the event

    protected void LinkButton_click(object sender, EventArgs e)
    {
    ....
    }

    to ensure that it's working, add a debug info

    Response.Write("Hello...");
     
    Alexey Smirnov, Jun 11, 2007
    #2
    1. Advertising

  3. Mel

    Mel Guest

    On Jun 11, 4:15 pm, Alexey Smirnov <> wrote:
    > On Jun 11, 10:35 pm, Mel <> wrote:
    >
    > > I have a website that allows the user to generate a new quote. When
    > > they are finished creating the quote, it brings them to the final page
    > > (called the Goodbye.aspx page) which just states the quote has been
    > > submitted and an email will arrive to them shortly.

    >
    > > I added a "Home" link button on this page which will return them to
    > > the website's home page. I want to clear out 10 session variables
    > > (contact name, ship to address, city, state, zip, etc.) when they
    > > click the Home button so it's ready for a new quote, however the
    > > LinkButton_click event is never fired. How do I clear the session
    > > variables from this Goodbye page?

    >
    > How does your button look like?
    >
    > Should be similar to this
    >
    > <asp:LinkButton ID="..." Text="Home" runat="server"
    > OnClick="LinkButton_click"></asp:LinkButton>
    >
    > and the event
    >
    > protected void LinkButton_click(object sender, EventArgs e)
    > {
    > ...
    >
    > }
    >
    > to ensure that it's working, add a debug info
    >
    > Response.Write("Hello...");


    It currently looks like this. I posted the click event code too (but
    it's not firing). Did I mention that I am a new user? So I hope it's
    something easy.


    'file: BMQQuoteGoodBye.aspx
    <asp:LinkButton ID="lbutHome" runat="server" PostBackUrl="~/
    FSMPTechHome.aspx"
    Style="z-index: 104; left: 36px; position: absolute; top:
    95px">Home</asp:LinkButton>

    'file: BMQQuoteGoodBye.aspx.vb
    Protected Sub lbutHome_Click(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles lbutHome.Click
    Session("OrdNum") = Nothing
    Session("ProjName") = Nothing
    Session("ShipAddr1") = Nothing
    Session("ShipAddr2") = Nothing
    Session("ShipCity") = Nothing
    Session("ShipSt") = Nothing
    Session("Customer") = Nothing
    Session("CusContact") = Nothing
    Session("CusPhone") = Nothing
    Session("ShipZip") = Nothing
    Session("PriceAdj") = Nothing
    End Sub
     
    Mel, Jun 11, 2007
    #3
  4. On Jun 11, 11:24 pm, Mel <> wrote:
    > On Jun 11, 4:15 pm, Alexey Smirnov <> wrote:
    >
    >
    >
    >
    >
    > > On Jun 11, 10:35 pm, Mel <> wrote:

    >
    > > > I have a website that allows the user to generate a new quote. When
    > > > they are finished creating the quote, it brings them to the final page
    > > > (called the Goodbye.aspx page) which just states the quote has been
    > > > submitted and an email will arrive to them shortly.

    >
    > > > I added a "Home" link button on this page which will return them to
    > > > the website's home page. I want to clear out 10 session variables
    > > > (contact name, ship to address, city, state, zip, etc.) when they
    > > > click the Home button so it's ready for a new quote, however the
    > > > LinkButton_click event is never fired. How do I clear the session
    > > > variables from this Goodbye page?

    >
    > > How does your button look like?

    >
    > > Should be similar to this

    >
    > > <asp:LinkButton ID="..." Text="Home" runat="server"
    > > OnClick="LinkButton_click"></asp:LinkButton>

    >
    > > and the event

    >
    > > protected void LinkButton_click(object sender, EventArgs e)
    > > {
    > > ...

    >
    > > }

    >
    > > to ensure that it's working, add a debug info

    >
    > > Response.Write("Hello...");

    >
    > It currently looks like this. I posted the click event code too (but
    > it's not firing). Did I mention that I am a new user? So I hope it's
    > something easy.
    >
    > 'file: BMQQuoteGoodBye.aspx
    > <asp:LinkButton ID="lbutHome" runat="server" PostBackUrl="~/
    > FSMPTechHome.aspx"
    > Style="z-index: 104; left: 36px; position: absolute; top:
    > 95px">Home</asp:LinkButton>
    >
    > 'file: BMQQuoteGoodBye.aspx.vb
    > Protected Sub lbutHome_Click(ByVal sender As Object, ByVal e As
    > System.EventArgs) Handles lbutHome.Click
    > Session("OrdNum") = Nothing
    > Session("ProjName") = Nothing
    > Session("ShipAddr1") = Nothing
    > Session("ShipAddr2") = Nothing
    > Session("ShipCity") = Nothing
    > Session("ShipSt") = Nothing
    > Session("Customer") = Nothing
    > Session("CusContact") = Nothing
    > Session("CusPhone") = Nothing
    > Session("ShipZip") = Nothing
    > Session("PriceAdj") = Nothing
    > End Sub- Hide quoted text -
    >
    > - Show quoted text -


    Mel,

    when you set the PostBackUrl, you post the page directly to
    FSMPTechHome.aspx

    Try to remove PostBackUrl="~/FSMPTechHome.aspx" and add to the end of
    lbutHome_Click() function the following line

    Response.Redirect("~/FSMPTechHome.aspx")

    Hope it helps
     
    Alexey Smirnov, Jun 11, 2007
    #4
  5. Mel

    Mel Guest

    On Jun 11, 4:31 pm, Alexey Smirnov <> wrote:
    > On Jun 11, 11:24 pm, Mel <> wrote:
    >
    >
    >
    >
    >
    > > On Jun 11, 4:15 pm, Alexey Smirnov <> wrote:

    >
    > > > On Jun 11, 10:35 pm, Mel <> wrote:

    >
    > > > > I have a website that allows the user to generate a new quote. When
    > > > > they are finished creating the quote, it brings them to the final page
    > > > > (called the Goodbye.aspx page) which just states the quote has been
    > > > > submitted and an email will arrive to them shortly.

    >
    > > > > I added a "Home" link button on this page which will return them to
    > > > > the website's home page. I want to clear out 10 session variables
    > > > > (contact name, ship to address, city, state, zip, etc.) when they
    > > > > click the Home button so it's ready for a new quote, however the
    > > > > LinkButton_click event is never fired. How do I clear the session
    > > > > variables from this Goodbye page?

    >
    > > > How does your button look like?

    >
    > > > Should be similar to this

    >
    > > > <asp:LinkButton ID="..." Text="Home" runat="server"
    > > > OnClick="LinkButton_click"></asp:LinkButton>

    >
    > > > and the event

    >
    > > > protected void LinkButton_click(object sender, EventArgs e)
    > > > {
    > > > ...

    >
    > > > }

    >
    > > > to ensure that it's working, add a debug info

    >
    > > > Response.Write("Hello...");

    >
    > > It currently looks like this. I posted the click event code too (but
    > > it's not firing). Did I mention that I am a new user? So I hope it's
    > > something easy.

    >
    > > 'file: BMQQuoteGoodBye.aspx
    > > <asp:LinkButton ID="lbutHome" runat="server" PostBackUrl="~/
    > > FSMPTechHome.aspx"
    > > Style="z-index: 104; left: 36px; position: absolute; top:
    > > 95px">Home</asp:LinkButton>

    >
    > > 'file: BMQQuoteGoodBye.aspx.vb
    > > Protected Sub lbutHome_Click(ByVal sender As Object, ByVal e As
    > > System.EventArgs) Handles lbutHome.Click
    > > Session("OrdNum") = Nothing
    > > Session("ProjName") = Nothing
    > > Session("ShipAddr1") = Nothing
    > > Session("ShipAddr2") = Nothing
    > > Session("ShipCity") = Nothing
    > > Session("ShipSt") = Nothing
    > > Session("Customer") = Nothing
    > > Session("CusContact") = Nothing
    > > Session("CusPhone") = Nothing
    > > Session("ShipZip") = Nothing
    > > Session("PriceAdj") = Nothing
    > > End Sub- Hide quoted text -

    >
    > > - Show quoted text -

    >
    > Mel,
    >
    > when you set the PostBackUrl, you post the page directly to
    > FSMPTechHome.aspx
    >
    > Try to remove PostBackUrl="~/FSMPTechHome.aspx" and add to the end of
    > lbutHome_Click() function the following line
    >
    > Response.Redirect("~/FSMPTechHome.aspx")
    >
    > Hope it helps- Hide quoted text -
    >
    > - Show quoted text -


    Okay thanks. Like this? Sorry to be a pain but I have never used
    the redirect method before.

    Protected Sub lbutHome_Click(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles lbutHome.Click
    Response.Redirect("~/FSMPTechHome.aspx")

    End Sub
     
    Mel, Jun 12, 2007
    #5
  6. On Jun 12, 2:30 pm, Mel <> wrote:
    > On Jun 11, 4:31 pm, Alexey Smirnov <> wrote:
    >
    >
    >
    >
    >
    > > On Jun 11, 11:24 pm, Mel <> wrote:

    >
    > > > On Jun 11, 4:15 pm, Alexey Smirnov <> wrote:

    >
    > > > > On Jun 11, 10:35 pm, Mel <> wrote:

    >
    > > > > > I have a website that allows the user to generate a new quote. When
    > > > > > they are finished creating the quote, it brings them to the final page
    > > > > > (called the Goodbye.aspx page) which just states the quote has been
    > > > > > submitted and an email will arrive to them shortly.

    >
    > > > > > I added a "Home" link button on this page which will return them to
    > > > > > the website's home page. I want to clear out 10 session variables
    > > > > > (contact name, ship to address, city, state, zip, etc.) when they
    > > > > > click the Home button so it's ready for a new quote, however the
    > > > > > LinkButton_click event is never fired. How do I clear the session
    > > > > > variables from this Goodbye page?

    >
    > > > > How does your button look like?

    >
    > > > > Should be similar to this

    >
    > > > > <asp:LinkButton ID="..." Text="Home" runat="server"
    > > > > OnClick="LinkButton_click"></asp:LinkButton>

    >
    > > > > and the event

    >
    > > > > protected void LinkButton_click(object sender, EventArgs e)
    > > > > {
    > > > > ...

    >
    > > > > }

    >
    > > > > to ensure that it's working, add a debug info

    >
    > > > > Response.Write("Hello...");

    >
    > > > It currently looks like this. I posted the click event code too (but
    > > > it's not firing). Did I mention that I am a new user? So I hope it's
    > > > something easy.

    >
    > > > 'file: BMQQuoteGoodBye.aspx
    > > > <asp:LinkButton ID="lbutHome" runat="server" PostBackUrl="~/
    > > > FSMPTechHome.aspx"
    > > > Style="z-index: 104; left: 36px; position: absolute; top:
    > > > 95px">Home</asp:LinkButton>

    >
    > > > 'file: BMQQuoteGoodBye.aspx.vb
    > > > Protected Sub lbutHome_Click(ByVal sender As Object, ByVal e As
    > > > System.EventArgs) Handles lbutHome.Click
    > > > Session("OrdNum") = Nothing
    > > > Session("ProjName") = Nothing
    > > > Session("ShipAddr1") = Nothing
    > > > Session("ShipAddr2") = Nothing
    > > > Session("ShipCity") = Nothing
    > > > Session("ShipSt") = Nothing
    > > > Session("Customer") = Nothing
    > > > Session("CusContact") = Nothing
    > > > Session("CusPhone") = Nothing
    > > > Session("ShipZip") = Nothing
    > > > Session("PriceAdj") = Nothing
    > > > End Sub- Hide quoted text -

    >
    > > > - Show quoted text -

    >
    > > Mel,

    >
    > > when you set the PostBackUrl, you post the page directly to
    > > FSMPTechHome.aspx

    >
    > > Try to remove PostBackUrl="~/FSMPTechHome.aspx" and add to the end of
    > > lbutHome_Click() function the following line

    >
    > > Response.Redirect("~/FSMPTechHome.aspx")

    >
    > > Hope it helps- Hide quoted text -

    >
    > > - Show quoted text -

    >
    > Okay thanks. Like this? Sorry to be a pain but I have never used
    > the redirect method before.
    >
    > Protected Sub lbutHome_Click(ByVal sender As Object, ByVal e As
    > System.EventArgs) Handles lbutHome.Click
    > Response.Redirect("~/FSMPTechHome.aspx")
    >
    > End Sub- Hide quoted text -



    Yes, it's correct:

    HOW TO: Use Response.Redirect in ASP.NET with Visual Basic .NET
    http://support.microsoft.com/kb/312063
     
    Alexey Smirnov, Jun 12, 2007
    #6
  7. Mel

    Mel Guest

    On Jun 12, 7:56 am, Alexey Smirnov <> wrote:
    > On Jun 12, 2:30 pm, Mel <> wrote:
    >
    >
    >
    >
    >
    > > On Jun 11, 4:31 pm, Alexey Smirnov <> wrote:

    >
    > > > On Jun 11, 11:24 pm, Mel <> wrote:

    >
    > > > > On Jun 11, 4:15 pm, Alexey Smirnov <> wrote:

    >
    > > > > > On Jun 11, 10:35 pm, Mel <> wrote:

    >
    > > > > > > I have a website that allows the user to generate a new quote. When
    > > > > > > they are finished creating the quote, it brings them to the final page
    > > > > > > (called the Goodbye.aspx page) which just states the quote has been
    > > > > > > submitted and an email will arrive to them shortly.

    >
    > > > > > > I added a "Home" link button on this page which will return them to
    > > > > > > the website's home page. I want to clear out 10 session variables
    > > > > > > (contact name, ship to address, city, state, zip, etc.) when they
    > > > > > > click the Home button so it's ready for a new quote, however the
    > > > > > > LinkButton_click event is never fired. How do I clear the session
    > > > > > > variables from this Goodbye page?

    >
    > > > > > How does your button look like?

    >
    > > > > > Should be similar to this

    >
    > > > > > <asp:LinkButton ID="..." Text="Home" runat="server"
    > > > > > OnClick="LinkButton_click"></asp:LinkButton>

    >
    > > > > > and the event

    >
    > > > > > protected void LinkButton_click(object sender, EventArgs e)
    > > > > > {
    > > > > > ...

    >
    > > > > > }

    >
    > > > > > to ensure that it's working, add a debug info

    >
    > > > > > Response.Write("Hello...");

    >
    > > > > It currently looks like this. I posted the click event code too (but
    > > > > it's not firing). Did I mention that I am a new user? So I hope it's
    > > > > something easy.

    >
    > > > > 'file: BMQQuoteGoodBye.aspx
    > > > > <asp:LinkButton ID="lbutHome" runat="server" PostBackUrl="~/
    > > > > FSMPTechHome.aspx"
    > > > > Style="z-index: 104; left: 36px; position: absolute; top:
    > > > > 95px">Home</asp:LinkButton>

    >
    > > > > 'file: BMQQuoteGoodBye.aspx.vb
    > > > > Protected Sub lbutHome_Click(ByVal sender As Object, ByVal e As
    > > > > System.EventArgs) Handles lbutHome.Click
    > > > > Session("OrdNum") = Nothing
    > > > > Session("ProjName") = Nothing
    > > > > Session("ShipAddr1") = Nothing
    > > > > Session("ShipAddr2") = Nothing
    > > > > Session("ShipCity") = Nothing
    > > > > Session("ShipSt") = Nothing
    > > > > Session("Customer") = Nothing
    > > > > Session("CusContact") = Nothing
    > > > > Session("CusPhone") = Nothing
    > > > > Session("ShipZip") = Nothing
    > > > > Session("PriceAdj") = Nothing
    > > > > End Sub- Hide quoted text -

    >
    > > > > - Show quoted text -

    >
    > > > Mel,

    >
    > > > when you set the PostBackUrl, you post the page directly to
    > > > FSMPTechHome.aspx

    >
    > > > Try to remove PostBackUrl="~/FSMPTechHome.aspx" and add to the end of
    > > > lbutHome_Click() function the following line

    >
    > > > Response.Redirect("~/FSMPTechHome.aspx")

    >
    > > > Hope it helps- Hide quoted text -

    >
    > > > - Show quoted text -

    >
    > > Okay thanks. Like this? Sorry to be a pain but I have never used
    > > the redirect method before.

    >
    > > Protected Sub lbutHome_Click(ByVal sender As Object, ByVal e As
    > > System.EventArgs) Handles lbutHome.Click
    > > Response.Redirect("~/FSMPTechHome.aspx")

    >
    > > End Sub- Hide quoted text -

    >
    > Yes, it's correct:
    >
    > HOW TO: Use Response.Redirect in ASP.NET with Visual Basic .NEThttp://support.microsoft.com/kb/312063- Hide quoted text -
    >
    > - Show quoted text -


    Thanks for your help, it works like a charm. I posted the code below
    in case someone else can benefit from it. Apparently clicking the
    Home link button calls the Page_Load event where I happened to be
    writing the quote record to the database so I had to enclose the
    Page_Load code with an IF statement "If Not IsPostBack Then" to ensure
    the database is only written once. Yep, that redirect method will be
    my new "favorite" friend. Oh just imagine the possiblities!

    Protected Sub lbutHome_Click(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles lbutHome.Click
    'Clear session variables before returning to the HOME page.
    Session("OrdNum") = Nothing
    Session("ProjName") = Nothing
    Session("ShipAddr1") = Nothing
    Session("ShipAddr2") = Nothing
    Session("ShipCity") = Nothing
    Session("ShipSt") = Nothing
    Session("Customer") = Nothing
    Session("CusContact") = Nothing
    Session("CusPhone") = Nothing
    Session("ShipZip") = Nothing
    Session("PriceAdj") = Nothing
    Response.Redirect("~/FSMPTechHome.aspx")
    End Sub
     
    Mel, Jun 12, 2007
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JoakimR
    Replies:
    3
    Views:
    3,665
    John Saunders
    Jan 8, 2005
  2. Mantorok

    LinkButton event not firing

    Mantorok, Feb 21, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    511
    Karl Seguin
    Feb 21, 2005
  3. GauravGupta
    Replies:
    4
    Views:
    2,111
    Shilpa1234
    Jan 19, 2012
  4. webdad3

    asp.net linkbutton event not firing

    webdad3, Jul 6, 2003, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    195
    Victor Garcia Aprea [MVP]
    Jul 7, 2003
  5. webdad3

    asp.net linkbutton event not firing

    webdad3, Jul 5, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    167
    webdad3
    Jul 5, 2003
Loading...

Share This Page