P
Peter Ehli
I have a custom control which is a set of tab images like in hotmail. In my control I have a hard coded array that sets the string
value of the tabs.
private String[] tabCaptions = { "Home", "Tab 1", "Tab 2", "Tab 3" };
I would like these tab captions set by the user of my control via the properties window. i.e. the code below that I have so far.
using System;
using System.ComponentModel.Design;
namespace NetParadigm.WebServerControls
{
public class TabEditor : ArrayEditor
{
public TabEditor() : base (typeof ( String ) )
{
}
}
}
Then I specify this editor via the editor attribute for my TabCaptions property as below
private String[] tabCaptions;
[EditorAttribute("TabEditor",typeof(System.Drawing.Design.UITypeEditor))]
public String[] TabCaptions
{
get
{
return tabCaptions;
}
set
{
tabCaptions = value;
}
}
This is just stubbed code and as far as I could get. This gives me an editor (i.e. click on the ellipse) window exactly like a
windows forms textbox when you set the Lines property values.
When these string values are set via this edior when my control is on a aspx page I get the below in Html view for the control
<cc1:NP_TabStrip id=NP_TabStrip1 runat="server" TabCaptions="String[] Array">
Of course I need to persist these values via view state and TabCaptions="String[] Array" bombs big time!
I've searched everywhere for an example of how to set a string array in my control and come up with a lot of fragments and unrelated
stuff. The Kothari book has an example of a CollectionEditor that is way too complex to disseminate for my use. Any ideas or a good
example of how to do this would be greatly appreciated. Thanks in advance.
Peter Ehli
value of the tabs.
private String[] tabCaptions = { "Home", "Tab 1", "Tab 2", "Tab 3" };
I would like these tab captions set by the user of my control via the properties window. i.e. the code below that I have so far.
using System;
using System.ComponentModel.Design;
namespace NetParadigm.WebServerControls
{
public class TabEditor : ArrayEditor
{
public TabEditor() : base (typeof ( String ) )
{
}
}
}
Then I specify this editor via the editor attribute for my TabCaptions property as below
private String[] tabCaptions;
[EditorAttribute("TabEditor",typeof(System.Drawing.Design.UITypeEditor))]
public String[] TabCaptions
{
get
{
return tabCaptions;
}
set
{
tabCaptions = value;
}
}
This is just stubbed code and as far as I could get. This gives me an editor (i.e. click on the ellipse) window exactly like a
windows forms textbox when you set the Lines property values.
When these string values are set via this edior when my control is on a aspx page I get the below in Html view for the control
<cc1:NP_TabStrip id=NP_TabStrip1 runat="server" TabCaptions="String[] Array">
Of course I need to persist these values via view state and TabCaptions="String[] Array" bombs big time!
I've searched everywhere for an example of how to set a string array in my control and come up with a lot of fragments and unrelated
stuff. The Kothari book has an example of a CollectionEditor that is way too complex to disseminate for my use. Any ideas or a good
example of how to do this would be greatly appreciated. Thanks in advance.
Peter Ehli