an ASP.NET Open Source CMS & eCommerce platform
Search:
Skip Navigation LinksHome > DotShoppingCart Blog
DotShoppingCart Blog
Forums module is ready

Forums module has been created on top of DotShoppingCart CMS platform. Our DotShoppingCart Forums have also been migrated to the new Forums module.

Add a custom ASP.NET UserControl into the DotShoppingCart page

DotShoppingCart CMS page is comprised by the server blocks, which are the pre-built server side controls. The out of box software comes with a handful of common blocks. The article is going to talk about creating your own server block.

Notice: read this blog entry for DotShoppingCart V2.5+.

1) Create the Standard ASP.NET stardard User Control and derive it from DotShoppingCart.OpenSource.Core.BlockUserControl

In the Page_Load method add the following code.

 public partial class YourCustomControls : BlockUserControl {
    protected void Page_Load(object sender, EventArgs e) {
        EnableViewState = WebUtils.IsPageEditorEnable();
        editor.BlockUserControl = this;
        if (ShowEditor) {
            pnlBlockContent.CssClass = "BlockEditPanel";
            editor.BlockTitle = string.Format("Your Custom Control {0}", BlockId);
        }
    }
}

In the ascx file add the following code.

 <%@ Register tagprefix="dsc" tagname="BlockEditor" src="/Controls/Blocks/BlockEditor.ascx" %>

 <dsc:BlockEditor id="editor" runat="server" />
<asp:Panel id="pnlBlockContent" runat="server">
    <%-- Place your control content here --%>
</asp:Panel>

A simple example is to check web\controls\blocks\Search.ascx and Search.ascx.cx files.

2) Hook up the new block in DB

Insert a new entry to dbo.DSC_Block_Type_lkp table e.g. INSERT INTO DSC_Block_Type_lkp (type, virtualPath) VALUES ('My Block', '/Controls/Blocks/MyBlock.ascx')

Insert a new entry to dbo.DSC_Block_Type_Group_Block_Type_Map

Recent Comments
lukezy said ...
Did you do #1 first to allow restrictedChars first?
Dissertations said ...
the ampersand in the latter will generate a “400 Bad Request” response with the def ...
Gus said ...
Need the multiple store I think its really important to be able to do that.   need as wel ...
Bahram said ...
 This feature is fancy and less actual use. Instead you must put your effort to efficiency ...
lukezy said ...
Please check our roadmap.