Don't change url in browser when <asp: LinkButton> is clicked

I have an ASP.NET page that uses an item-based menu on asp:LinkButton

the master page. When the user selects a menu item, the handler onclick

calls a method in my C # code. The method it calls just executes Server.Transfer()

onto a new page. From what I've read, this shouldn't change the url displayed in the browser.

The problem is that the URL changes in the browser when the user moves the menu to different pages.

Here is the menu item:

<asp:LinkButton id="foo" runat="server" onclick="changeToHelp"><span>Help</span>
</asp:LinkButton>

      

In my C # code, I am handling the event with a method like:

protected void changeToHelp(object sender, EventArgs e)
{
    Server.Transfer("Help.aspx");
}

      

Any ideas on how I can navigate the menu without changing the browser bar?

0


source to share


2 answers


You can use an iframe to make sure the browser url doesn't change. In Page_Load you can change the iframe src attribute to help.aspx



+1


source


Try it Server.Execute("Help.aspx")

. You can save the form if you need using



Server.Execute("Help.aspx",true);

      

0


source







All Articles