More in this section

Forums / Developing with Sitefinity / inherit from CommentList

inherit from CommentList

5 posts, 0 answered
  1. Levi
    Levi avatar
    12 posts
    Registered:
    29 Jun 2008
    16 Dec 2009
    Link to this post
    I'm using sitefinity 3.5, and I am trying to create a web user control that inherits from Telerik.Cms.Engine.WebControls.CommentsList.

    This is the error im getting:

    Compiler Error Message: ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).

    Source Error:

    Line 11: using Telerik.Cms.Engine.WebControls;
    Line 12: 
    Line 13: public partial class BlogCommentsList : Telerik.Cms.Engine.WebControls.CommentsList
    Line 14: {
    Line 15:     protected void Page_Load(object sender, EventArgs e)

    This is what my ascx file looks like:
    <%@ Control Language="C#"  CodeFile="BlogCommentsList.ascx.cs" Inherits="BlogCommentsList" %>


  2. Levi
    Levi avatar
    12 posts
    Registered:
    29 Jun 2008
    16 Dec 2009
    Link to this post
    Just wanted to add, my goal is to handle the submit button on click event when a comment is posted.  I tried following the advice from another post and this is the error I get after following those instructions.

    So, if there is another solution I am open to that.
  3. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    16 Dec 2009
    Link to this post
    Hello Levi,

     You need to create a custom class - in App_Code or a new Class Library and add the logic there. You cannot override classes in user controls.


    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  4. Levi
    Levi avatar
    12 posts
    Registered:
    29 Jun 2008
    16 Dec 2009
    Link to this post
    Ahh, yeah I figured I was doing that wrong.  I did as you suggested and it works now.  Thanks Ivan!
  5. Levi
    Levi avatar
    12 posts
    Registered:
    29 Jun 2008
    16 Dec 2009
    Link to this post
    Nope, I still can't get it to work.  Now I'm getting this:

    Parser Error Message: Type 'ASP.customcontrols_wspblogcommentslist_ascx' does not have a public property named 'Template'.

    Source Error: 

    Line 54: <div class="sf_postComments" runat="server" id="postCommentsPlh">
    

    Line 55: <wsp:WSPBlogCommentsList ID="commentsList" runat="server" CssClass="sf_commentsList">
    Line 56: <Template>
    Line 57: <asp:Repeater ID="commentsRepeater" runat="Server"> Line 58: <HeaderTemplate>

    Do you guys have a complete example of how I can do what I want to do (handle the submit button click for posting comments, or providing my own CommenstList control, etc).  There is just too much going on under the hood with all these templates, etc that I can't get my head wrapped around what I need to do.

    *EDIT* -- Nevermind, I got it to work.  <wsp:WSPBlogCommentsList> was a web user control by mistake.  Once I pointed <wsp:WSPBlogCommentsList> to my class in App_Code it worked.  Thanks again!
Register for webinar
5 posts, 0 answered