Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ASP.NET
<abc:Mytabledesc ID="tblname"  runat="server" Table="my_table_name" 
                TableColumns="Column_name_1,Column_name_2,Column_name_3,Column_name_4,Column_name_5,Column_name_6,Column_name_7,Column_name_8"
                TableColumnsTitles="||Column1|column name 2|Column name 3|colun name 4|colun name 5|colun name 6|colun name 7"
                PrimaryKeys="colun name 1" SequenceForPrimaryKey="colun name 4" ReadOnlyColumns="colun name 2"
                MandatoryColumns="Column_name_1,Column_name_2,Column_name_3,Column_name_4,Column_name_5,Column_name_6,Column_name_7,Column_name_8"
                OrderBy="Column_name_1,Column_name_2"  
                Where="Column_name_1=1" />

I have a table above in aspx file i want to add date time picker control for only two column named as Column_name_2 and Column_name_5 in this when i click on the edit button on the side of it with the text box Column_name_2 a datetimeicket control also appear through which i can add the date as well time with it.
Posted
Updated 19-Jun-13 23:53pm
v3

1 solution

1) Add AJAX Control toolkit dll[^] as a reference.

2) Include
C#
<asp:toolkitscriptmanager id="ToolkitScriptManager2" runat="server" xmlns:asp="#unknown">
</asp:toolkitscriptmanager>
in your page.

3) Then use below code in edit item template of gridview along with textbox.[example to show how to use it]
C#
<asp:TextBox ID="DateTextBox" runat="server"  />
<asp:Image ID="Image1" runat="server" ImageUrl="Calendar_scheduleHS.png" />
<ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server"
    TargetControlID="DateTextBox" PopupButtonID="Image1">
</ajaxToolkit:CalendarExtender>


[in case of table]

you can simply use just textbox and calender extender.

You can only add date using any of the date picker,because which time would be considered if you select e.g. 19th july 1998? Think over it.

Regards.. :laugh:
 
Share this answer
 
v8
Comments
Harishankar Maurya 3-Aug-13 5:13am    
How to use Date time picker within Edit Item template of the Grid View
Thanks7872 3-Aug-13 5:16am    
You just have to put the code in Edit Item Template of gridview. The code wont change for it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900