Multiline String Properties?

Posted by Community Admin on 04-Aug-2018 09:51

Multiline String Properties?

All Replies

Posted by Community Admin on 25-May-2011 00:00

It's entirely possible that I'm being stupid, but any light you can shed would be appreciated!

I have created a custom UserControl for the footer of my website. One of the properties of the control is for storing the business address. I originally had this as a simple string property, but when this is displayed in the backend it is shown as a single line textbox. I wanted this to be a multiline textbox (much better for an address field), so changed the property as follows:

01.namespace SitefinityWebApp.UserControls
02.
03.    abstract public class TypeNames
04.    
05.        // Each constant below should be on a single line
06.        public const string UITypeEditor = "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
07.        public const string MultilineEditor = "System.ComponentModel.Design.MultilineStringEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
08.    
09. 
10.    public partial class GTC_Footer : System.Web.UI.UserControl
11.    
12.        private string[] _footerAddress = new string[6];
13. 
14.        [Category("General"), Editor(TypeNames.MultilineEditor, TypeNames.UITypeEditor)]
15.        public virtual string[] FooterAddress
16.        
17.            get
18.            
19.                return this._footerAddress;
20.            
21.            set
22.            
23.                this._footerAddress = value;
24.            
25.        

When I go to edit the property in the backend, rather than a single line textbox it displays a button that when clicked opens another dialog window to edit the property. However, there is still no multiline textbox, but what appears to be more properties of the field (see attached screenshot).

Any ideas how to get a multiline textbox instead?

Help would be much appreciated!

Paul

Posted by Community Admin on 28-May-2011 00:00

Hi Paul,

I think the best approach here would be to create a custom control designer for your control. There you can define the interface for editing your widget. You can find a tutorial on the creation of control designers here. I have also attached a quick sample user control with two text fields, one using the rich text editor.

Greetings,
Radoslav Georgiev
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 06-Jun-2011 00:00

Lovely. I'll let you know how I get on :)

Posted by Community Admin on 15-Jun-2011 00:00

Excellent. Thanks for that - it helped a treat!

It seems a little cumbersome to hand-edit the client-side javascript file - it was this bit that took the time, and indeed is the hardest to debug. Is there an easy way to create a skeleton file with the relevant property stubs in it, or should I be taking one that already works and hacking about with it (the method I am currently employing)?

Paul

Posted by Community Admin on 15-Jun-2011 00:00

Hi Paul,

We use the ASP.NET ScriptControl implementation. For the client component you can create a template that will be almost the same for each of your custom widgets.

Here are several articles that you can check.




Regards,
Ivan Dimitrov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 22-Feb-2012 00:00

Excellent Post. Got it to work in less that 10 mins. :)

Will have to tweak for my needs. Thanks!

This thread is closed