How to use date time picker or any other equivalent control in Gridview control ?
Suppose i have 5 rows in my gridview control.
For all these rows i want this date time picker.so that user can select a date using this control and when i will click on insert then i want to insert this date time value to database.
You can find a solution in the below articles:
http://www.codeproject.com/KB/grid/DATETIMEPICKER_GRIDVIEW.aspx
http://msdn.microsoft.com/en-us/7tas5c80.aspx
Hope this helps you a bit.. All the Best..!!
Rakesh Vikram
This article will help u
its nice one.
Write the code in the as below way
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) {.... }
For the CheckBox column, it has already implemented in DataGridView, you can use it easily.
void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { CheckBox cb = e.Control as CheckBox; if (cb != null) { cb.Checked = true;//false due to your business logic. } }
void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
CheckBox cb = e.Control as CheckBox; if (cb != null) { cb.Checked = true;//false due to your business logic. }
CheckBox cb = e.Control as CheckBox;
if (cb != null)
cb.Checked = true;//false due to your business logic.
}
A quick search has given the following code.. hope it helps
Hi Ajit,I think there is some way to handle this. I think you can use datetimepicker directly in gridview like any other controls. Just have a look here in this link they have provide same thing
Or
We can do one thing. We can create a custom control for datepicker and just add that in a column of gridview. And you can easily worked on that.I think this is another way to solve your problem. Go thr these links whcih will give u an idea of how to impliment a datepicker in asp.net. You can easily use that in your page. So now just think of using same in your gridview. Try it.
http://www.15seconds.com/issue/040315.htm
http://www.codeproject.com/KB/aspnet/Datepickercontrol.aspx
Best Luck!!!!!!!!!!!Sujit.