How do I specify a required attribute in a custom .NET Web control?

放肆的年华 提交于 2019-12-05 03:11:24

I don't know that there's an attribute for this. I believe on the Page_Load event (or perhaps some rendering event) just check if the value has been set. If not then throw an exception.

I don't think this is possible. Consider that the designer needs to be able to create an instance of the control when it's dragged from the toolbox. At that time, it's going to have default values for properties, and these values need to be valid.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!