locked
custom control RRS feed

  • Question

  • User-1681750595 posted

    i want to create a custom datacontrol. how i can make available all those data properties like datasource,databind(),itemtemplete, all those events etc.  

    Monday, February 8, 2010 9:46 AM

Answers

  • User1759999623 posted

    WebCategory and WebSysDescription are internal classes inside System.Web and cannot be used outside of the base Framework library.

    You can, however, use the CategoryAttribute class [Category("Layout")] which indicates the category group your control is in as it is displayed in the Properties box in Visual Studio, while the DescriptionAttribute class [Description("DataList_ExtractTemplateRows")] is used to provide a description of your properties/methods within the Properties box.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 9, 2010 2:26 PM

All replies

  • User-1379894896 posted

    Implement all related interfaces, apply all related attibutes and events.

    (or simply derive from datalist, repeater or like that)

    Monday, February 8, 2010 10:10 AM
  • User1759999623 posted

    The best way to start with a data custom control is to inherit the BaseDataBoundControl class.  This will give you properties such as DataSource and DataSourceID and methods such as DataBind.  As for ItemTemplate, you would either need to build your own, or you could inherit from any of the existing controls that use.  In other words, if what you want is to expand on the GridView control, then inherit from the GridView and then add on your new properties and methods and override the properties and methods that you want to change from the GridView (noting you may not be able to override all methods and properties).

    Monday, February 8, 2010 10:18 AM
  • User-1681750595 posted

    [WebCategory("Layout")]

    [WebSysDescription("DataList_ExtractTemplateRows")]

    what is this two & how to access or use it ?

    Monday, February 8, 2010 10:40 AM
  • User1759999623 posted

    WebCategory and WebSysDescription are internal classes inside System.Web and cannot be used outside of the base Framework library.

    You can, however, use the CategoryAttribute class [Category("Layout")] which indicates the category group your control is in as it is displayed in the Properties box in Visual Studio, while the DescriptionAttribute class [Description("DataList_ExtractTemplateRows")] is used to provide a description of your properties/methods within the Properties box.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 9, 2010 2:26 PM