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

Forums / General Discussions / User Control Properties

User Control Properties

4 posts, 0 answered
  1. John
    John avatar
    4 posts
    Registered:
    21 Oct 2010
    25 Nov 2010
    Link to this post
    Hi,

    I've made a simple user control with some public properties, the c# code inside a script server tag. I copied this .ascx file into a Controls folder in my web application. I registered the control under Administration -> Settings -> Advance -> Toolboxes ....  so the control displays well on the toolbox. I add it to my page but I dont have access to its public properties when I click "Edit". Documentation says that SiteFinity will automatically generate a Property Grid editor for all the public properties. Where ? How ? I don't know if I'm missing something.

    I would appreciate any help to continue my evaluation process.

    Thanks,
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    25 Nov 2010
    Link to this post
    Hi John,

    Create a code behind file of your ascx and put the properties there or use a class library.

    All the best,
    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. John
    John avatar
    4 posts
    Registered:
    21 Oct 2010
    25 Nov 2010
    Link to this post
    Thanks for your reply.
     
    I did it with a code behind file, with and without dll copied in sitefinity bin folder and it doesn't work either. Properties are not available.

    I've got to say that I'm using VS 2008 to make a simple user control and then to copy it in my SF 4.0 RC application. Is it correct this way ?

    Regards, 
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    25 Nov 2010
    Link to this post
    Hi John,

    Below is a sample control that you can use

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="SitefinityWebApp.Controls.WebUserControl1" %>
     
     
    <asp:Literal runat="server" ID="Literal1"></asp:Literal>
    <asp:TextBox runat="server" ID="TextBox1"></asp:TextBox>
    <asp:HyperLink runat="server" ID="HyperLink1"></asp:HyperLink>


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
     
    namespace SitefinityWebApp.Controls
    {
        public partial class WebUserControl1 : System.Web.UI.UserControl
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                Literal1.Text = Title;
                TextBox1.Text = Body;
                HyperLink1.Text = LinkText;
                HyperLink1.NavigateUrl = LinkUrl;
            }
     
            public string Title
            {
                get { return this._title; }
                set { this._title = value; }
            }
            public string Body
            {
                get { return this._body; }
                set { this._body = value; }
            }
            public string LinkText
            {
                get { return this._linktext; }
                set { this._linktext = value; }
            }
            public string LinkUrl
            {
                get { return this._linkurl; }
                set { this._linkurl = value; }
            }
     
            private string _title;
            private string _body;
            private string _linktext;
            private string _linkurl;
        }
    }


    Greetings,
    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
4 posts, 0 answered