ASP.NET UserControl class library

前端 未结 6 1129
情话喂你
情话喂你 2021-02-08 12:11

Is it possible to create class libraries that contain UserControls so I can reuse them? If so, how? Is the markup compiled with the .dll? Thanks for any help!

6条回答
  •  梦谈多话
    2021-02-08 12:34

    It sounds like custom server controls are what you are looking for.

    If your controls are a combination of other server controls (e.g. a textbox and a button for a date control), then you could look at CompositeDataBoundControl and CompositeControl - these are handy ways of working with this sort of thing.

    Beware, however, that it is very easy to get confused by the way the page cycle/viewstate re-hydration works. I've lost quite a bit of time over this, due to subtle misunderstandings of how it should work.

    http://aspnetresources.com/blog/composite_databound_control.aspx

提交回复
热议问题