Reuse aspx page for multiple pages using url parameters?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
bemara579
Lieutenant (LT)
Lieutenant (LT)
Posts: 63
Joined: Thu Feb 19, 2009 6:15 pm

Reuse aspx page for multiple pages using url parameters?

Post by bemara579 » Mon Apr 20, 2009 4:31 pm

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?

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

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

Post by jmestep » Mon Apr 20, 2009 5:12 pm

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.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
nickc
Captain (CAPT)
Captain (CAPT)
Posts: 276
Joined: Thu Nov 29, 2007 3:48 pm

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

Post by nickc » Mon Apr 20, 2009 8:26 pm

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...

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

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

Post by mazhar » Tue Apr 21, 2009 2:36 am

Perhaps in this situation where display would be same just different contents so making use of web pages would be better.

Post Reply