By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,969 Members | 1,522 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,969 IT Pros & Developers. It's quick & easy.

LinkButton click event not firing

P: n/a
Mel
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?

Jun 11 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
On Jun 11, 10:35 pm, Mel <MLights...@gmail.comwrote:
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...");

Jun 11 '07 #2

P: n/a
Mel
On Jun 11, 4:15 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Jun 11, 10:35 pm, Mel <MLights...@gmail.comwrote:
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

Jun 11 '07 #3

P: n/a
On Jun 11, 11:24 pm, Mel <MLights...@gmail.comwrote:
On Jun 11, 4:15 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:


On Jun 11, 10:35 pm, Mel <MLights...@gmail.comwrote:
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

Jun 11 '07 #4

P: n/a
Mel
On Jun 11, 4:31 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Jun 11, 11:24 pm, Mel <MLights...@gmail.comwrote:


On Jun 11, 4:15 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Jun 11, 10:35 pm, Mel <MLights...@gmail.comwrote:
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

Jun 12 '07 #5

P: n/a
On Jun 12, 2:30 pm, Mel <MLights...@gmail.comwrote:
On Jun 11, 4:31 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:


On Jun 11, 11:24 pm, Mel <MLights...@gmail.comwrote:
On Jun 11, 4:15 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Jun 11, 10:35 pm, Mel <MLights...@gmail.comwrote:
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

Jun 12 '07 #6

P: n/a
Mel
On Jun 12, 7:56 am, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Jun 12, 2:30 pm, Mel <MLights...@gmail.comwrote:


On Jun 11, 4:31 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Jun 11, 11:24 pm, Mel <MLights...@gmail.comwrote:
On Jun 11, 4:15 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Jun 11, 10:35 pm, Mel <MLights...@gmail.comwrote:
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

Jun 12 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.