My Development Notes

By Haemoglobin
3/10/2010 (revision 1)

Navigation

Cross-Page Posting

Set the button's PostBackUrl property to the page to post back to, then on the new page:

protected void Page_Load(object sender, EventArgs e) {
    if(Page.PreviousPage != null) {
        string text = ((TextBox))PreviousPage.FindControl("TextBox1")).Text;

        //or if a public wrapper is provided on the old page and <%@ PreviousPageType VirtualPath="~/ProcessingPage.aspx" %> exists
        string text = PreviousPage.PageData;
    }
}

Redirects


Response.Redirect("AnotherPage.aspx"); //user's browser does a redirection
Server.Transfer("AnotherPage.aspx", false); //user transferred to the other page server side (url in browser doesn't change)
//Boolean to specify if form and request data is posted through or not. 

Site Map

Stored in a Web.sitemap file (xml hierarchy of siteMapNode entries).

    Response.Redirect(SiteMap.CurrentNode.ParentNode.Url); 

    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" StartingNodeOffset="0" ShowStartingNode="false"/>

    //Dynamic menu
    <asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1" Orientation="Horizontal"/>
    //Or use other controls such as TreeView. You can also use an XmlDataSource here. 

    //The SiteMapPath control can be used to show a breadcrumb of where the user is in the navigation.



Comments

Powered by BlogEngine.NET 1.6.1.0 | Design by styleshout | Enhanced by GravityCube.net | 1.4.5 Changes by zembian.com | Adapted by HamishGraham.NET
(c) 2010 Hamish Graham. Banner Image (c) Chris Gin