Visual Studio .NET - Using date time picker or equivalent control in Gridview control ?

Asked By Ajit Ghule on 04-Jun-08 06:59 AM

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.

Datetime picker in ASP.net gridview - Rakesh Vikram replied to Ajit Ghule on 04-Jun-08 07:16 AM

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

nice article of datetimepicker for gridview - Deepak Ghule replied to Ajit Ghule on 04-Jun-08 07:24 AM

This article will help u

http://www.codeproject.com/KB/grid/DATETIMEPICKER_GRIDVIEW.aspx

its nice one.

 

Gridview control reply - alice johnson replied to Ajit Ghule on 04-Jun-08 12:17 PM

 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.

 

Code Snippet

 

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.

}

}

A quick search has given the following code.. hope it helps

http://www.codeproject.com/KB/grid/DATETIMEPICKER_GRIDVIEW.aspx

Try This - Sagar P replied to Ajit Ghule on 05-Jun-08 12:49 AM

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

http://www.codeproject.com/KB/grid/DATETIMEPICKER_GRIDVIEW.aspx

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.