Creating Editable Custom widgets
Hi there,
I'm looking to create a custom content widget that is editable for the user and Im not really sure which approach to take. At the moment I have created a user control and added it to the toolbox, but when I click on edit, I dont have the option to add my content. How do go about this? I attached a picture of the end product for clarity. Essentially, the user should be able to edit the text but leave the underlying styling and functionality alone.
Thanks!
Peter
Hi Peter,
What you want to create is a User Control. Here's a way to create a simple User Control:
In the .ascx file of the control, for example put this:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SimpleControl.ascx.cs" Inherits="SitefinityWebApp.UserControls.SimpleControl" %> <p> Here is some text: <asp:Label ID="Label1" Font-Bold="true" runat="server" /></p>public partial class SimpleControl : System.Web.UI.UserControl private string _labeltext; public string LabelText get return _labeltext; set _labeltext = value; protected void Page_Load(object sender, EventArgs e) Label1.Text = LabelText; Thanks man, that was absolutely perfect!
Thanks for the help
Hi Peter,
You're welcome! Thanks again for using our services.
Greetings,
Svetoslav Petsov
the Telerik team