A 15 Minute CMS using RadGrid and RadEditor

Thread is closed for posting
13 posts, 0 answers
  1. 78C3B137-E2EA-4459-8402-7347F45A7CFE
    78C3B137-E2EA-4459-8402-7347F45A7CFE avatar
    885 posts
    Member since:
    Nov 2003

    Posted 03 Sep 2009 Link to this post

    Requirements

    RadControls version

        2009.2.701.35

    .NET version

    3.5 SP1

    Visual Studio version

    VS 2008

    programming language

    C#

    browser support

    all browsers supported by RadControls


    PROJECT DESCRIPTION
    This project demonstrates how to use 2 Telerik controls to enable:
    • WebPage content editing
    • Spell checking
    • Insert colored formatted Code (Snippets)
    • Insert and upload images
    and that within about 15 minutes - writing just a few lines of code. I have no documentation for it - but I guess the video explains all: http://www.pp-p.net/microcmssite/

    I use this thing by myself - a bit more extended - but it took me also less than an hour to build it.

    And to solve the puzzle about the GroupName (I didn't tell in the video): I use this field to filter my content records in the RadGrid. So I can easily (for an example) find all the content which belongs to the Product Demo pages.

    Have fun

    Manfred
  2. 7AD2B9E2-F8AA-477C-8C9C-0CA6841FFC40
    7AD2B9E2-F8AA-477C-8C9C-0CA6841FFC40 avatar
    24 posts
    Member since:
    Jan 2008

    Posted 24 Sep 2009 Link to this post

    Hello Manfred,
    I am trying to build a small cms system like shown in your video.  When I get to C# code for the DBContent control I get this error:

    Error 1 'MicroCMSsite.DataThings.DataAccessDataContext' does not contain a definition for 'MWebContent' and no extension method 'MWebContent' accepting a first argument of type 'MicroCMSsite.DataThings.DataAccessDataContext' could be found (are you missing a using directive or an assembly reference?) C:\Users\Bryan\Documents\DHL\MicroCMSsite\MicroCMSsite\MicroCMSsite\Controls\DBContent.ascx.cs 32 42 MicroCMSsite

    I added the using MicroCMSsite.DataThings;  as well, so at this point im not really sure what it could be.  I set my table up just like you did.  I am hoping you have ran across this before....

    Is there anything you can think of that would cause this?  I have never used linq before but I really want to.  I think this cms is a nice little tool that would be very helpful to me as well.

    Thank you,
    Bryan
  3. 78C3B137-E2EA-4459-8402-7347F45A7CFE
    78C3B137-E2EA-4459-8402-7347F45A7CFE avatar
    885 posts
    Member since:
    Nov 2003

    Posted 25 Sep 2009 Link to this post

    Hy Brian,

    after you made the table in your SQL Database (exactly as I showed) open DataAccess.dbml.
    This will show (maybe) an error about the existing table in it.
    Mark the table - delete it.
    Drag your table (from Server Explorer) to the DataAccess.dbml surface and compile again.

    This should fix the problem.

    Regards

    Manfred
  4. 78C3B137-E2EA-4459-8402-7347F45A7CFE
    78C3B137-E2EA-4459-8402-7347F45A7CFE avatar
    885 posts
    Member since:
    Nov 2003

    Posted 25 Sep 2009 Link to this post

    An other way is to open DataAccess.dbml in "source mode" (simply with notepad - or in VS "open with...XML".
    It will look like this:
    Snippet created with CBEnhancer
    <?xml version="1.0" encoding="utf-8"?>
    <Database Name="PPPNetData" Class="DataAccessDataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
      <Connection Mode="WebSettings" ConnectionString="Data Source=spppex1;Initial Catalog=PPPNetData;Integrated Security=True" SettingsObjectName="System.Configuration.ConfigurationManager.ConnectionStrings" SettingsPropertyName="PPPNetDataConnectionString" Provider="System.Data.SqlClient" />
      <Table Name="dbo.MWebContent" Member="MWebContent">
        <Type Name="MWebContent">
          <Column Name="MWebContentID" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
          <Column Name="PageName" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" UpdateCheck="Never" />
          <Column Name="GroupName" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" UpdateCheck="Never" />
          <Column Name="TheContent" Type="System.String" DbType="NVarChar(MAX) NOT NULL" CanBeNull="false" UpdateCheck="Never" />
        </Type>
      </Table>
    </Database>
    Change the connection string that it matches your SQL Server.
    Also change the PPPNet... connection string in web.config

    Manfred
  5. 7AD2B9E2-F8AA-477C-8C9C-0CA6841FFC40
    7AD2B9E2-F8AA-477C-8C9C-0CA6841FFC40 avatar
    24 posts
    Member since:
    Jan 2008

    Posted 25 Sep 2009 Link to this post

    Hello Manfred, thanks for the replys.  I knew you would respond.  I tried both these methods with no luck.  Both gave same error.  I checked all connection strings in web.config and in DataAccess.dbml as well.  They all matched mine.  Are you using SQL2005?  I have a couple of different servers I can try it on and a local sqlexpress as well.  That is all I know to do at this point.  Any other ideas?

    Thanks,
    Bryan
  6. 78C3B137-E2EA-4459-8402-7347F45A7CFE
    78C3B137-E2EA-4459-8402-7347F45A7CFE avatar
    885 posts
    Member since:
    Nov 2003

    Posted 25 Sep 2009 Link to this post

    Hmmmm,

    just to ensure - is your table name MWebContent?
    If not - you have to replace this name with the one of your table (change class in designer).

    Linq2SQL allows you to drag a table to the designer and (by default) it will build a class named like this table.
    BUT - if you select the table in the designer choose properties and change the Name field there to MWebContent this should work.

    Regards
    Manfred
    PS: of course I answer :) I am bit stress (frustrated?) setting up a windows 7 x64 box - but always when the system is stable I check
    my mail....
    You may ask about frustration?
    Simple - I get an errror: 'package 'Visual Web Developer HTML SourceEditor Package' has failed to load properly (GUID={xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}}'
    After uninstalling VS (including all telerik product, Azure SDK.....) and a reinstall - I still get the error.
    Later I found a post telling "Goto VS options - choose a different language - reset - restart" -- That (30 second procedure) fixed it :)
  7. 7AD2B9E2-F8AA-477C-8C9C-0CA6841FFC40
    7AD2B9E2-F8AA-477C-8C9C-0CA6841FFC40 avatar
    24 posts
    Member since:
    Jan 2008

    Posted 25 Sep 2009 Link to this post

    My table name is MWebContent... I see what you are saying though and I appreaciate the help.  I beleive It will work just may take a little tinkering. lol.. 

    P.S.  Windows 7 Rocks man.  I run vista at work--->hate it.  I run 7 at home---->love it.  Works well if you have dual monitors as well.

    Thanks,
    Bryan
  8. 78C3B137-E2EA-4459-8402-7347F45A7CFE
    78C3B137-E2EA-4459-8402-7347F45A7CFE avatar
    885 posts
    Member since:
    Nov 2003

    Posted 25 Sep 2009 Link to this post

    Hi Bryan,

    yes win7 rocks - especially if you have 3 monitors (2 little 19" and one 24") :))
    -- but 64 (especially in "not english") brings up some "nice problems" (drivers, etc).

    About your problem -- another idea - can you write the following code in DBContent.aspx.cs?
    Snippet created with CBEnhancer
    private void Test() {
        DataAccessDataContext dC = new DataAccessDataContext();
        dC.MWebContent.First().GroupName = "XXX";
    }
    The second line should bring up Intellisense as soon as you type dC. (notice the dot).
    If it doesn't something is going wrong....

    Manfred
  9. 7AD2B9E2-F8AA-477C-8C9C-0CA6841FFC40
    7AD2B9E2-F8AA-477C-8C9C-0CA6841FFC40 avatar
    24 posts
    Member since:
    Jan 2008

    Posted 25 Sep 2009 Link to this post

    Sweet I will try this in a few and let you know, ive been pulled away from the project for now. 

    Three monitors, that does sound sweet.
  10. 7AD2B9E2-F8AA-477C-8C9C-0CA6841FFC40
    7AD2B9E2-F8AA-477C-8C9C-0CA6841FFC40 avatar
    24 posts
    Member since:
    Jan 2008

    Posted 30 Sep 2009 Link to this post

    Hey Manfred just wanted to let you know I got this to work.  I got a chance to work on it today and noticed that in the xml was off.
    Member="MWebContent"
    This was Member="MWebContents"

    Anyway I changed my code and it worked.  This thing is sweet though.  Thanks again for the help...

    P.S.
    How did your win7 install turn out? 
  11. 7AD2B9E2-F8AA-477C-8C9C-0CA6841FFC40
    7AD2B9E2-F8AA-477C-8C9C-0CA6841FFC40 avatar
    24 posts
    Member since:
    Jan 2008

    Posted 15 Oct 2009 Link to this post

    Hey Manfred, hows it going?  I am working with this cms using the radgrid and editor and I am now having a problem.  Everything is working great for me with the exception of a few different columns.  I have managed to get the cms editor to work the way it is but now I need to add a DateCreated and EndDate fields.  I have already added and they work with the existing code, the only thing is that I want them to be inserted automaticaly.  Normally I would do something like this...

     Public Sub Insert()  
            Dim i As New NewsArticles  
            i.NewsArticleName = txtHeadline.Text  
            i.NewsArticleText = RadEditor1.Content  
            i.DateCreated = DateTime.Now  
            i.EndDate = DateTime.Now.AddDays(30)  
            i.Insert()  
        End Sub 

    Now that I am using the link to sql class I am a little lost,  not sure where I would set the date so the user doesn't have to enter it everytime.  Any ideas on how I would do this?

    Thank you very much,
    Bryan
  12. 78C3B137-E2EA-4459-8402-7347F45A7CFE
    78C3B137-E2EA-4459-8402-7347F45A7CFE avatar
    885 posts
    Member since:
    Nov 2003

    Posted 16 Oct 2009 Link to this post

    Hi,

    Linq2SQL gives you a lot of freedom doing such things.
    Since it the generated classes are partial you can easily extend them.
    I assume your Linq2SQL class has the name WebContent and the namespace is ManniAT.
    Change those 2 names to your need.

    To go on:
    a.) in Project Explorer on the folder DataThings right click - choose add class - name it "DataHelpers"
    --the name does not really matter
    b.) remove all content from the file
    c.) add the following code (check namespace and class name!!!)
    Snippet created with CBEnhancer
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;

    namespace ManniAT.DataThings {
        public partial class WebContent {
            partial void OnCreated() {
                DateCreated = DateTime.Now;
                EndDate = DateTime.Now.AddDays(30);
            }
        }
    }
    With this your should be fine!

    Regards
    Manfred
  13. A73FCEBA-5DB7-41AD-9722-7B6C57FA2276
    A73FCEBA-5DB7-41AD-9722-7B6C57FA2276 avatar
    11 posts
    Member since:
    Mar 2010

    Posted 24 Nov 2010 Link to this post

    Hi ManFred,

    Just thought I'd drop you a note to say thankyou for this amazing video.  It was exactly what I was wanting to implement, and having seen you do it, there's no way I would have managed it myself!

    I'll be erecting a small shrine in your honour.  :)

    Mark
Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.