Page 1 of 1

Reuse aspx page for multiple pages using url parameters?

Posted: Mon Apr 20, 2009 4:31 pm
by bemara579
I wanted to make a new page for my store, but find myself continually doing this. Is there a way I can create one page and have it reused by the scriplets? So for example, I create a Static.aspx. Then I can navigate to it like:

http://mydomain.com/static.aspx?scriptlet=aboutus
http://mydomain.com/static.aspx?scriptlet=references
http://mydomain.com/static.aspx?scriptlet=events

Any ideas on how to do this?

Re: Reuse aspx page for multiple pages using url parameters?

Posted: Mon Apr 20, 2009 5:12 pm
by jmestep
If you are talking about just different content on the page, you can add a webpages in the admin under a particular category and reuse the display page the way you do the product display page.

Re: Reuse aspx page for multiple pages using url parameters?

Posted: Mon Apr 20, 2009 8:26 pm
by nickc
Sure - as long as you implement AbleCommercePage.
I load an alternate "Landing Page" based on a database setting, with a small modification to default.aspx...

Here's the content tag in my default.aspx:

Code: Select all

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="PageContent">
    <cb:ScriptletPart ID="HomePage" runat="server" Title="Home Page" AllowClose="False" AllowMinimize="false"
        Layout="HomePage" 
        Header="Toolbar Only Header"
        Content="Home Page"
        Footer="Standard Footer" />
</asp:Content>
and the code that manipulates it:

Code: Select all

public partial class Default : CommerceBuilder.Web.UI.AbleCommercePage
{
    protected void Page_Init(object sender, EventArgs e)
    {
        if (SiteInformation.Current.Properties.ContainsKey("LandingPage"))
        {
            string landingPage = SiteInformation.Current.Properties["LandingPage"].ToString();
            if (landingPage.Contains("/"))
                Response.Redirect(landingPage);
            else
                this.HomePage.Content = landingPage;
        }
    }
}
You'd be capturing, parsing or logically assigning the scriptlet name from Request.Querystring, and setting ScriptletPartId.Content as that value...

Re: Reuse aspx page for multiple pages using url parameters?

Posted: Tue Apr 21, 2009 2:36 am
by mazhar
Perhaps in this situation where display would be same just different contents so making use of web pages would be better.