|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
control exposing collection.Hi all,
Iam trying to design a web server control using asp.net 2.0, that has a collection exposed. so that user can specify list elements in the markup. like <uc1:MyControl id="Mycontrol1" runat="server" property1="value"> <Item name="value" prop1="value"></Item> </uc1:MyControl> wondering if the item class has to be a control too, and how should i expose this collection so that asp.net realizes this as a valid markup, and populates the objects at page load... any help would be appreciated. TIA Check out the ParseChildrenAttribute class. That affects how your class is
deserialized (parsed) by the asp engine such that you can handle child elements differently than the default. The default behavior, I believe, is to attempt to add them as children of the Controls collection, in which case, a) it would need to be a control, and b) you'd need to qualify it with a tagname so that the engine knows what type to deserialize the markup to. Thanks Keith,
i found an example of a control at by using ControlBuilder class on http://samples.gotdotnet.com/quickstart/aspplus/doc/webctrlauthoring.aspx#builder I did exactly as mentioned in the sample by defining three classes, one for the main control, one for the child control, and one for the ControlBuilder, and then by decorating the main control class with the derived ControlBuilder but now the XHTML validator throws error saying that child element not supported !, and would show object reference error on the design view of the form am i missing anything ? thanks for your help again Keith Patrick wrote: Show quoteHide quote > Check out the ParseChildrenAttribute class. That affects how your class is > deserialized (parsed) by the asp engine such that you can handle child > elements differently than the default. The default behavior, I believe, is > to attempt to add them as children of the Controls collection, in which > case, a) it would need to be a control, and b) you'd need to qualify it with > a tagname so that the engine knows what type to deserialize the markup to. > > never mind i found out what the problem was :)
Ashish wrote: Show quoteHide quote > Thanks Keith, > > i found an example of a control at by using ControlBuilder class on > http://samples.gotdotnet.com/quickstart/aspplus/doc/webctrlauthoring.aspx#builder > > > I did exactly as mentioned in the sample by defining three classes, one > for the main control, one for the child control, and one for the > ControlBuilder, and then by decorating the main control class with the > derived ControlBuilder > > > but now the XHTML validator throws error saying that child element not > supported !, and would show object reference error on the design view of > the form > > am i missing anything ? > > thanks for your help again > > > > > > > > > Keith Patrick wrote: > >> Check out the ParseChildrenAttribute class. That affects how your >> class is deserialized (parsed) by the asp engine such that you can >> handle child elements differently than the default. The default >> behavior, I believe, is to attempt to add them as children of the >> Controls collection, in which case, a) it would need to be a control, >> and b) you'd need to qualify it with a tagname so that the engine >> knows what type to deserialize the markup to. >> never mind i found out what the problem was :)
Ashish wrote: Show quoteHide quote > Thanks Keith, > > i found an example of a control at by using ControlBuilder class on > http://samples.gotdotnet.com/quickstart/aspplus/doc/webctrlauthoring.aspx#builder > > > I did exactly as mentioned in the sample by defining three classes, one > for the main control, one for the child control, and one for the > ControlBuilder, and then by decorating the main control class with the > derived ControlBuilder > > > but now the XHTML validator throws error saying that child element not > supported !, and would show object reference error on the design view of > the form > > am i missing anything ? > > thanks for your help again > > > > > > > > > Keith Patrick wrote: > >> Check out the ParseChildrenAttribute class. That affects how your >> class is deserialized (parsed) by the asp engine such that you can >> handle child elements differently than the default. The default >> behavior, I believe, is to attempt to add them as children of the >> Controls collection, in which case, a) it would need to be a control, >> and b) you'd need to qualify it with a tagname so that the engine >> knows what type to deserialize the markup to. >> never mind i found out what the problem was :)
Ashish wrote: Show quoteHide quote > Thanks Keith, > > i found an example of a control at by using ControlBuilder class on > http://samples.gotdotnet.com/quickstart/aspplus/doc/webctrlauthoring.aspx#builder > > > I did exactly as mentioned in the sample by defining three classes, one > for the main control, one for the child control, and one for the > ControlBuilder, and then by decorating the main control class with the > derived ControlBuilder > > > but now the XHTML validator throws error saying that child element not > supported !, and would show object reference error on the design view of > the form > > am i missing anything ? > > thanks for your help again > > > > > > > > > Keith Patrick wrote: > >> Check out the ParseChildrenAttribute class. That affects how your >> class is deserialized (parsed) by the asp engine such that you can >> handle child elements differently than the default. The default >> behavior, I believe, is to attempt to add them as children of the >> Controls collection, in which case, a) it would need to be a control, >> and b) you'd need to qualify it with a tagname so that the engine >> knows what type to deserialize the markup to. >>
Any hints on how to do frames in ASP.Net 2.0?
Remove Dynamic User Controls from a collection Custom Treenodes in Treeview Would like to get two items from a dropdownlist link on an entire row in a datagrid Gridview - Accessing a field value in current row DropDownList VS TextBox Customizing a TreeNode's viewstate controlToValidate property of compareValidator combo box customs |
|||||||||||||||||||||||