Suppose I have a user control in win application and that has few control like:
- Employee name - textbox
- Employee age - textbox
- Employee sex - combo
- etc...
Now I want to develop a generic user control in such a way that when I will assign something like usercontrolInstance.Databind=mydataset
, then all the control will be populated with data.
If I can develop in this way then code will be reuse and approach will be professional.
I have no idea how could i develop user control in such a way where property called datasource will be there and when i assign my dataset to that property then all the textboxes in user control will be populated with data......Please guide me.开发者_如何学Python
Thanks.Have a look at these links:
- CodeProject: Implementing complex data binding in custom controls
- MSDN Walkthrough: Creating a User Control that Supports Simple Data Binding
- Walkthrough: Creating a User Control that Supports Complex Data Binding
- Walkthrough: Creating a User Control that Supports Lookup Databinding
精彩评论