+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Error in custom module

Error in custom module

4 posts, 0 answered
  1. higgsy
    higgsy avatar
    336 posts
    Registered:
    05 Aug 2010
    15 Nov 2010
    Link to this post
    Hi all,

    I'm developing a custom module and am hitting a problem. The following line in the Admin ListView Control Template is giving the following error:

    Compiler Error Message: CS1061: 'System.Web.UI.Control' does not contain a definition for 'ItemEditUrl' and no extension method 'ItemEditUrl' accepting a first argument of type 'System.Web.UI.Control' could be found (are you missing a using directive or an assembly reference?)

    Line 38:    <telerik:ClientTemplatesHolder id="GridTemplates" runat="server">
    Line 39:        <telerik:ClientTemplate Name="Edit" runat="server">
    Line 40:            <a href="<%= Parent.Parent.ItemEditUrl %>"><asp:Literal Text="<%$ Resources:GlobalModule, Label_Edit %>" runat="server" /></a>
    Line 41:        </telerik:ClientTemplate>
    Line 42:        <telerik:ClientTemplate Name="Delete" runat="server"

    The class for this controltemplate is:

    using System;
    using Telerik.Cms.Engine.WebControls.Admin;
     
    namespace App_Code.Modules.Members.MembersModule.WebControls.Admin
    {
        /// <summary>
        /// View for displaying the list of case studies
        /// </summary>
        public class MembersListView : ContentItemsList<MembersView>
        {
             
            #region View layout and template
     
            public override string LayoutTemplatePath
            {
                get { return "~/lib/controls/membersModule/backend/MembersListView.ascx"; }
            }
     
            #endregion
     
            #region Command overrides
     
            /* by overrideing the commands we can make the base module behave differently, while
             * keeping all of its base functionality */
     
            /// <summary>
            /// Gets the item view URL.
            /// </summary>
            /// <value>The item view URL.</value>
            public override string ItemViewUrl
            {
                get
                {
                    return CreateHostViewCommand<MembersPreviewView>("{#ID#}");
                }
            }
     
            /// <summary>
            /// Gets the item edit URL.
            /// </summary>
            /// <value>The item edit URL.</value>
            public override string ItemEditUrl
            {
                get
                {
                    return CreateHostViewCommand<MembersEditView>("{#ID#}");
                }
            }
     
            /// <summary>
            /// Gets the new item command.
            /// </summary>
            /// <returns></returns>
            protected override string GetNewItemCommand()
            {
                return CreateHostViewCommand<MembersNewView>();
            }
     
            /// <summary>
            /// Gets the preview item command.
            /// </summary>
            /// <param name="itemId">The item id.</param>
            /// <returns></returns>
            protected override string GetPreviewItemCommand(Guid itemId)
            {
                return CreateHostViewCommand<MembersPreviewView>(itemId.ToString());
            }
     
     
            protected override string GetFilterListCommand(string filter)
            {
     
                return this.CreateHostViewCommand<MembersListView>(filter);
     
            }
     
            #endregion
     
            #region Security overrides
     
            /* by overriding the permissions methods, we can substitute the permissions for generic content
             * module with permissions for case studies module, while we leave the base class to perform the
             * business logic based on these permissions */
     
            /// <summary>
            /// Checks the permission.
            /// </summary>
            /// <param name="right">The right.</param>
            /// <returns></returns>
            protected override bool CheckPermission(int right)
            {
                return this.Host.MembersManager.GetPermission(right).CheckDemand();
            }
     
            #endregion
        }
    }

    Am i missing something? The only difference between this, and a module I've built previously is that this code all lives within the App_Code folder, whereas the previous module was a pluggable module.

    Any help greatly appreciated.

    Regards,
    Higgsy
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    15 Nov 2010
    Link to this post
    Hi higgsy,

    You should add the view type

    <a href="<%= ((App_Code.Modules.Members.MembersModule.WebControls.Admin.MembersListView)Parent.Parent).ItemEditUrl %>">


    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. higgsy
    higgsy avatar
    336 posts
    Registered:
    05 Aug 2010
    16 Nov 2010
    Link to this post
    Hi Ivan,

    That worked perfectly, thanks.

    Quick question  - does a custom module have to have a content field? The reason I ask is because I am getting the following error:

    A required control was not found in the template for "~/lib/controls/membersModule/backend/MembersNewView.ascx". The control must be assignable form type "System.Web.UI.IEditableTextControl" and must have ID "Editor".


    Which has occured after deleting the Editor from my module. One last question about the modules. Does every field have to be a metafield? For example I am creating a members module and three of the inputs are username / password and email address - do these have to be metafields?

    Thanks
    higgsy
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    16 Nov 2010
    Link to this post
    Hello higgsy,

    In your module you have set a control - RadEditor with ID="Editor" as a required control. If you are implementing a GenericContent based control we require the RadEditor in most of the views.
    Metafields are dynamic fields and they are used to persist some data. When you use dynamic fields you do not have to write your own persistence classes.

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
4 posts, 0 answered