Basically, I am confused about how to implement databinding on the control side.
I am trying to write a custom list control in C#, which implements databinding. I want it to end up having similar functionality to the ListView, but with an interface similar to ListBox.
I have a private nested class called "ListRow" which handles rendering of each row. There is an internal binding source which gets changes from the data and causes the control to invalidate if necessary. The problem now is that I want to add a checkbox to the ListRow, and I am not sure the best way to implement it so that the underlying object's property gets changed.
Open a design surface in the editor and choose View > Data Sources. Add a data source to your project. Set the control that is created when you drag an item from the Data Sources window to the designer. Modify the list of controls that are associated with items in the Data Sources window.
Description. Simple data binding. The ability of a control to bind to a single data element, such as a value in a column in a dataset table. Simple data binding is the type of binding typical for controls such as a TextBox control or Label control, which are controls that typically only display a single value.
ASP.NET 2.0 introduces the GridView, FormView, and DetailsView controls, which let you use <%# Bind("FieldName") %> syntax that provides two-way data binding.
try to follow this example. http://www.codeproject.com/KB/database/DataBindCustomControls.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With