Tech Off Thread

4 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.


Back to Forum: Tech Off
  • User profile image

    Hi. I am doing some stuff in 2.0 and im kinda new at this. I am a hardcore windows dev and now im doing a website. so does anyone know how to change pages from code-behind? if you could email me at

    i would appricate any help!


  • User profile image

    First you need to create the markup (html). Then you can access from codebehind by giving the element an ID and add the runat="server" attribute. You may also use the components in the html.


    <a href="#" id="coolLink" runat="server">This is a cool link</a>

    coolLink.Href = "";

    Using the link:

    <asp:LinkButton id="coolLink" PostBackUrl="" runat="server">LinkButton</asp:LinkButton>

    coolLink.PostBackUrl = "";

    You could also read a book on ASP.NET:

    Btw. Changing the title to something more meaningful wouldn't be that bad!

  • User profile image

    Your question is a bit unclear. When you say "change a page from a code-behind" do you mean you want to dynamically change the content genererated at a specific page or do you want to go to another page.

    If you are looking for help on how to change the content generated by a page, you need to spend some time reading a book on or perhaps reading the background artices on MSDN.

    If you  want to go to another page you have two choices:

    1) Server.Transfer([url of the page you want to go to], true)

    2) Response.Redirect([url of the page you want to go to])

    In most cases you'll want to use option 2, but not in all cases.

  • User profile image


Conversation locked

This conversation has been locked by the site admins. No new comments can be made.