K
kruiz
Hi, hope somebody could help me! ... I'm building a Toolbar Web Custom
Control. So i created 3 classes,
[ PersistChildren(false),
ParseChildren(false, "Buttons"),
ControlBuilder(typeof(ToolbarControlBuilder))]
public class Toolbar: WebControl
public class ToolbarButtonCollection: CollectionBase
public class ToolbarButton: WebControl
As it can be deducted, the Toolbar lists several buttons which are
contained in the ToolBarButtonCollection class. The ToolbarButton owns
one Button and one ImageButton which only one is rendered depending on
a given property.The Design-time insertions are made automatically with
the IDE's editor. (a VS window which allows to add and remove items).
I have 2 questions/problems:
1.All the buttons that I create in design-time, are inserted as
individual controls in the page's code-behind. Which is rather annoying
and not wished at all. How could I revert this? My guess is that is
because i'm inheriting from WebControl and using the default Collection
Editor. So to assign an ID automatically to the control, the IDE must
insert the control into the code-behind.
An example is:
public class WebForm3 : System.Web.UI.Page
{
protected NetControls.Web.UI.ToolbarButton toolbarButton1;
protected NetControls.Web.UI.ToolbarButton toolbarButton2;
protected NetControls.Web.UI.Toolbar Toolbar1;
2. When I set the Visible property to false on the Toolbar, the value
is propagted to the Child Buttons. But when I re-set it to TRUE, all
the Buttons remain with the Visible="False" attribute on the aspx page.
My workaround is to set the property in the Toolbar's Render method,
but I think better would be on the Visible property set accesor.
Well I hope someone could help me on this...
Bye
Thanks in advance
KATLIM
Control. So i created 3 classes,
[ PersistChildren(false),
ParseChildren(false, "Buttons"),
ControlBuilder(typeof(ToolbarControlBuilder))]
public class Toolbar: WebControl
public class ToolbarButtonCollection: CollectionBase
public class ToolbarButton: WebControl
As it can be deducted, the Toolbar lists several buttons which are
contained in the ToolBarButtonCollection class. The ToolbarButton owns
one Button and one ImageButton which only one is rendered depending on
a given property.The Design-time insertions are made automatically with
the IDE's editor. (a VS window which allows to add and remove items).
I have 2 questions/problems:
1.All the buttons that I create in design-time, are inserted as
individual controls in the page's code-behind. Which is rather annoying
and not wished at all. How could I revert this? My guess is that is
because i'm inheriting from WebControl and using the default Collection
Editor. So to assign an ID automatically to the control, the IDE must
insert the control into the code-behind.
An example is:
public class WebForm3 : System.Web.UI.Page
{
protected NetControls.Web.UI.ToolbarButton toolbarButton1;
protected NetControls.Web.UI.ToolbarButton toolbarButton2;
protected NetControls.Web.UI.Toolbar Toolbar1;
2. When I set the Visible property to false on the Toolbar, the value
is propagted to the Child Buttons. But when I re-set it to TRUE, all
the Buttons remain with the Visible="False" attribute on the aspx page.
My workaround is to set the property in the Toolbar's Render method,
but I think better would be on the Visible property set accesor.
Well I hope someone could help me on this...
Bye
Thanks in advance
KATLIM