Reputation: 4283
I have a C# ASP.NET project with a gridview. The gridview has a dataset as a datasource.
The grid includes a date field, but when you edit that field, you have to type in the date, and can't select a date since its a textbox.
How will you go about changing the control of a gridview.
This is what I've tried but it didn't work. (Just tried to convert all the textboxes to a calender as a test.
foreach (TableCell cell in grdViewDetails.Rows[e.RowIndex].Cells)
{
cell.Controls[0] = cell.Controls[0] as Calendar; //This didnt work....
//do other stuff
}
Upvotes: 0
Views: 282
Reputation: 2319
change the date column to template fiels. In edit template add a calender extender to the textbox. Simple.
Upvotes: 0
Reputation: 8109
Instead of doing that u can simply use calender exterder of ajax tool kit.here is the lnik for more details.Link
Upvotes: 1