• Decrease Text SizeIncrease Text Size

Centralpoint Navigation page to standard Asp.net page

Posted Date: 5/2/2023
    Printer Friendly Version   Email A Friend   Add This   Increase Text Size   Decrease Text Size
You can point the Centralpoint Navigation page to the standard Asp.net page. This way your programming knowledge of Centralpoint can be minimized.


In order to do this you will have to follow the steps below:
Step 1
Download asp.net page modified to be used in centralpoint.

Step 2
Move unzipped directory to your development website.(\\serverIP\Centralpoint\WebSites\cpweb_Development\Root) 

see Image:
 


Step 3
Login into the centralpoint console and click on the Site Architecture navigation item.

Step 4
Click the new button on the top of the grid.

Step 5
Enter the Name of the page. select Header Type = HTML(if you need a page header) if not then none or Inherit.
Page Type = URL and point into /my_Pages/File1.aspx and click the save button at the bottom of the page.

see Image:
 

Step 5
Navigate to this page by entering website http://websiteURL.com/Main/SystemNameYouJustCreated.aspx


This webpage contains several examples on how to connect and retrieve data from Centralpoint Modules.

File1.aspx


      <%@ page language="C#" masterpagefile="~/Web.master" autoeventwireup="true" codefile="File1.aspx.cs" inherits="Centralpoint.WebSite.Uploads._File1" trace="false" %>
      <asp:content id="cntCenter" runat="server" contentplaceholderid="cphCenter">
	<div id="divHeader" runat="server" class="title"/>
    <div id="divHeaderContent" runat="server"/>
    <div id="divContent" runat="server"/>
     <br />
    <div>Taxonomy:</div>
     <asp:listbox id="lbTaxonomy" runat="server" width="150" rows="1" appenddatabounditems="true">
        <asp:listitem text="Please Select"  value=""></asp:listitem>
    </asp:listbox>
     <br />
    <div>Keyword:</div>
     <asp:listbox id="lbKeyword" runat="server" width="150" rows="1" appenddatabounditems="true">
        <asp:listitem text="Please Select"  value=""></asp:listitem>
    </asp:listbox>
     <br />
     <table cellpadding="4" cellspacing="4">
         <tr>
             <td valign="top">
                <div>Content#1:</div>
                <asp:datagrid id="dgContent1" runat="server" autogeneratecolumns="true" />
             </td>
             <td valign="top">
                <div>Content#2:</div>
                <asp:datagrid id="dgContent2" runat="server" autogeneratecolumns="true" />
             </td>
         </tr>
          <tr>
             <td valign="top">
                <div>Content#3:</div>
                <asp:datagrid id="dgContent3" runat="server" autogeneratecolumns="true" />
             </td>
             <td valign="top">
                <div>Content#4:</div>
                <asp:datagrid id="dgContent4" runat="server" autogeneratecolumns="true" />
             </td>
         </tr>
     </table>
</asp:content>
   




File1.aspx.cs


using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Centralpoint;
using Centralpoint.Web;
using Centralpoint.Web.Cms;
using Centralpoint.Web.UI;
using Centralpoint.Web.UI.Controls;
using System.Web.Configuration;


namespace Centralpoint.WebSite.Uploads
{
    public partial class _File1 : Centralpoint.WebSite.Page
	{
		protected override void OnLoad(EventArgs e)
		{
            divHeaderContent.InnerHtml = this.SiteMapInfo.Attributes.Get("HeaderContent");
			base.OnLoad(e);

            Guid taxonomyId = new Guid("176c40b6-d627-41a3-8b4f-a2d48cf0dbb0");
            if (!this.IsPostBack)
            {
                //GetTaxonomy
                lbTaxonomy.DataSource = CpContent.GetTaxonomy(taxonomyId, "PhysicianDirectory", "TaxonomyId, Name", "SortOrder, Name");
                lbTaxonomy.DataTextField = "Name";
                lbTaxonomy.DataValueField = "TaxonomyId";
                lbTaxonomy.DataBind();

                //GetKeywordList
                lbKeyword.DataSource = CpContent.GetKeywordList("CellPhoneProviders");
                lbKeyword.DataTextField = "Text";
                lbKeyword.DataValueField = "Value";
                lbKeyword.DataBind();

                //GetTable#1
                string key = "CpSystem.cpsys_Taxonomy";
                DataTable dt = CpCache.Get(key, false, false) as DataTable;
                if (dt == null)
                {
                    dt = CpContent.GetTable("cpsys_Taxonomy", String.Format("SELECT TOP 3 TaxonomyId, [Name] FROM cpsys_Taxonomy WHERE  TaxonomyId IN (SELECT TaxonomyId FROM cpsys_TaxonomyAncestors WHERE AncestorTaxonomyId = '{0}') ORDER by [Name]", taxonomyId));
                    CpCache.Insert(key, dt, new string[] { }, new string[] { }, true, false, false, false, false);
                }
                dgContent1.DataSource = dt;
                dgContent1.DataBind();

                //GetTable#2
                key = "CpSystem.ModuleInfo.SystemNames";
                CpContent content = CpContent.GetCache(key, SystemFilterOptions.None);
                if (content == null)
                {
                    content = new CpContent(key, SystemFilterOptions.None);
                    content.AddTable("cpsys_Modules", "SELECT TOP 3 ModuleId, SystemName FROM cpsys_Modules");
                    content.InsertCache();
                }
                dgContent2.DataSource = content.Tables["cpsys_Modules"];
                dgContent2.DataBind();

                
                using (SqlConnection connection = new SqlConnection(Management.Application.SelectConnectionString))
                {
                    //GetTable#3
                    SqlCommand command = new SqlCommand("SELECT TOP 3 ModuleId, SystemName FROM cpsys_Modules", connection);
                    connection.Open();
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        dgContent3.DataSource = reader;
                        dgContent3.DataBind();
                    }
                    
                    //GetTable#4
                    dgContent4.DataSource = Utilities.Database.GetDataTable("cpsys_Modules", "SELECT TOP 3 ModuleId, SystemName FROM cpsys_Modules", connection);
                    dgContent4.DataBind();
                }
              
            }
		}
	}
}
       










Related Taxonomy

Comments:

Be the first to leave a comment.
Please Login to post comments.