Ask a Question related to ASP.NET Building Controls, Design and Development.
-
studen771 #1
ListItemCollection for a listbox within a composite control
Thanks in advance to anyone who can help :)
First, you'll have to pardon my very 'beginner' status on custom controls..
I'm creating a composite control that includes a listbox, and i want to be
able to add/remove items within it both in design time and runtime, just as
the default listbox behaves in the vs.net designer.
The 'ListItemCollection' property is read-only, and thus I don't know how to
enable this functionality either in design time or runtime. I tried creating
a public propery of type 'ListItemCollection' within the composite control,
yet in the vs.net designer (design time) it ignores any additional items I
attempt to add to the listbox.
1 ) If I create a object derived from the Listbox control, can I achieve
this functionality? If so, how? OR ---
2) Can I simply do this within the existing composite control? If so how?
Also, some additional resources explaining the functionality of server
controls within composite controls would be greatly appreciated...
I've perused the internet quite a bit but there does not seem to be clear
explanations available.
studen771 Guest
-
Composite dropdownlist control that also displays a listbox????
This is driving me crazy, I am trying to build a custom dropdownlist that when rendered also displays a listbox next to it. I am going to use the... -
Losing Composite Control property that another Composite Control ...
Hi, I'm creating 2 composite controls in ASP.net. Control 1 is a Search control and control 2 is a Map control. I have added a property... -
Possible to create a composite control that has a child control that is a validator that validates the composite control itself?
I am attempting to create a composite control which has a label, followed by an optional error message, followed by two text boxes. I have... -
Composite ListBox Control
I don't know if I understand you correctly, but why would you want to change the name of your child controls? If you want to ensure that all of... -
Using Table control in a custom composite control. Control does not render properly in design time.
All, I have written a very simple custom composite control that includes a control of type System.Web.UI.WebControls.Table. The control... -
Chris Taylor #2
Re: ListItemCollection for a listbox within a composite control
Hi,
I do not do a terrible amount of web controls, but I would suggest you look
at exposing a property
of type ListItemCollection as you did and add the add the Editor attribute
something like the following:
[Editor("System.Web.UI.Design.WebControls.ListItems CollectionEditor,System.Design,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
typeof(UITypeEditor)),
PersistenceMode(PersistenceMode.InnerDefaultProper ty),
MergableProperty(false)]
public virtual ListItemCollection Items
{
...
}
I have not tested this, but I hope it at least get you going in the right
direction.
--
Chris Taylor
[url]http://dotnetjunkies.com/weblog/chris.taylor[/url]
"studen771" <studen771@discussions.microsoft.com> wrote in message
news:5E22C93A-A3D1-44DE-AE6F-956C58277AA3@microsoft.com...> Thanks in advance to anyone who can help :)
>
> First, you'll have to pardon my very 'beginner' status on custom
> controls..
>
> I'm creating a composite control that includes a listbox, and i want to be
> able to add/remove items within it both in design time and runtime, just
> as
> the default listbox behaves in the vs.net designer.
>
> The 'ListItemCollection' property is read-only, and thus I don't know how
> to
> enable this functionality either in design time or runtime. I tried
> creating
> a public propery of type 'ListItemCollection' within the composite
> control,
> yet in the vs.net designer (design time) it ignores any additional items
> I
> attempt to add to the listbox.
>
> 1 ) If I create a object derived from the Listbox control, can I achieve
> this functionality? If so, how? OR ---
> 2) Can I simply do this within the existing composite control? If so how?
>
> Also, some additional resources explaining the functionality of server
> controls within composite controls would be greatly appreciated...
>
> I've perused the internet quite a bit but there does not seem to be clear
> explanations available.
Chris Taylor Guest



Reply With Quote

