Don't Change URL in Browser When Clicking <asp:LinkButton>
Posted
by Corey Goldberg
on Stack Overflow
See other posts from Stack Overflow
or by Corey Goldberg
Published on 2008-12-08T17:14:03Z
Indexed on
2010/04/03
0:03 UTC
Read the original article
Hit count: 232
I have an ASP.NET page that uses a menu based on asp:LinkButton control in a Master page. When a user selects a menu item, an onclick handler calls a method in my C# code. The method it calls just does a Server.Transfer() to a new page. From what I have read, this is not supposed to change the URL displayed in the browser.
The problem is it that the URL changes in the browser as the user navigates the menu to different pages.
Here is an item in the menu:
<asp:LinkButton id="foo" runat="server" onclick="changeToHelp"><span>Help</span>
</asp:LinkButton>
In my C# code, I handle the event with a method like:
protected void changeToHelp(object sender, EventArgs e)
{
Server.Transfer("Help.aspx");
}
Any ideas how I can navigate through the menu without the browser's URL bar changing?
© Stack Overflow or respective owner