Multiline String Properties?
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.
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
Lovely. I'll let you know how I get on :)
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
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.
Excellent Post. Got it to work in less that 10 mins. :)
Will have to tweak for my needs. Thanks!