User Control Properties
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,
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
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,
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;