Is this function worth for creating custom control in asp.net
I thought of creating a control for the purpose that shows tex开发者_C百科tbox for adding email address and a button that posts the value after client side validation with validation control and when that email is valid it would add it to checkedboxlist and display it. Now how would this fit into a control scenario.
Usercontrol addresses specific cases like databinding and displaying but this seems much like whole function needs to be bundled up with control, is required as dll/assembly but user is only interested in value of email address.
What BaseClass would fit this scenario?
If i followed the Control class i will have to do drudge work of handling the postback value, binding it to the checkbox but i get fine control over what is rendered.
When i use usercontrol[ascx] to do same, functionality and display could be packaged but what about dll/assembly should i provide a public datasource property if the user wanted to databind the control?
If i used Composite controls it would sound great :) , But does it handle postbacks or i should handle drudge work
If you are looking to ship your control out for use in many other projects or in the public domain then create a Control or CompositeControl class as it could be packaged up into a DLL easily, but as you already are aware it's more work, and there are no limitations to what you can do in the class.
If not then create an ASCX, these allow for a rapid turnaround but obviously are more difficult if you want to re-use them frequently, it is possible to package up an ASCX but sometimes it's not worth the headache.
Is that what you are asking?
精彩评论