Reputation: 7639
I've created 4 Data GridView Dynamically. The Data Source of each of the gridviews is a DataTable. It has 3 columns, first column type being string, second and third column being DateTime. The First Column has static data. On clicking the second and third column cells, I want a DateTimePicker to come allowing user to select DateTime Value.
Upvotes: 0
Views: 3130
Reputation: 7639
I think it might be possible to do changes doing DataBindings, but I choose not to look into it. Instead of attaching DataTable as DataSource, I took e.g mentioned here MSDN customised it as per my needs and then created DataGridViewColumns and iterated over Rows of DataTable to fill up content. I did write any template code.
Upvotes: 0
Reputation: 706
Try something like this - Make a new DataTable (that has the schema you need). Then add 2 or 3 controls (one for string input, and either CheckBox or 2 radioButtons that will determine which DateTime column will be filled). When user clicks on DateTimePicker, it will fill one column, then he can selects/deselects the CheckBox, and select the second date. When all values are properly set, user can click the Submit button that: - Fills the DataTable with proper data. - Changes the DataGridView's DataSource
This is just my idea on how you can solve this, there may be another way.
Upvotes: 0
Reputation: 51
You may need a template Row, see details here:
http://social.msdn.microsoft.com/Forums/br/netfxbcl/thread/2677158c-76a3-4e65-8ae4-18373a80516e
Upvotes: 1