The Expiration Date textbox shows the calendar when clicked but when selected nothing is inserted into the database for this field, the rest of the columns are inserted. Thanks!
Edit: When I do an update it works but the select, update and delete are from Gridview. I use DetailsView for insert.
oned_gk I changed it like you said but did not work with this also
Edit: Dude, that helped me, I tested this templatefield for other columns and it stopped working for the column names that have spaces so I changed the columns names and it started working like charm! So the the problem here is Eval does allow spaces but
Bind does not allow.
spandy
Member
22 Points
24 Posts
Detailsview Insert is not working with Ajax Calendar Extender
Jan 07, 2013 08:09 PM|LINK
The Expiration Date textbox shows the calendar when clicked but when selected nothing is inserted into the database for this field, the rest of the columns are inserted. Thanks!
Edit: When I do an update it works but the select, update and delete are from Gridview. I use DetailsView for insert.
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager2" runat="server"> </ajaxToolkit:ToolkitScriptManager> <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px" DefaultMode="Insert" OnItemInserted= "Inserted" AutoGenerateInsertButton="True" CellPadding="4" DataKeyNames="Name,Softwares,License Number" AutoGenerateRows="false" DataSourceID="AccessDataSource1" ForeColor="#333333" GridLines="None"> <Fields> <asp:BoundField DataField="Name" HeaderText="Name" ReadOnly="True" SortExpression="Name" /> <asp:BoundField DataField="Softwares" HeaderText="Softwares" ReadOnly="True" SortExpression="Softwares" /> <asp:BoundField DataField="License Number" HeaderText="License Number" ReadOnly="True" SortExpression="License Number" /> <asp:BoundField DataField="Software Version" HeaderText="Software Version" SortExpression="Software Version" /> <asp:TemplateField HeaderText="Expiration Date"> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Eval("[Expiration Date]") %>'></asp:Label> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("[Expiration Date]") %>'></asp:TextBox> <ajaxToolkit:CalendarExtender Format="MM-dd-yyyy" Id="CalendarExtender1" runat="server" targetcontrolid="TextBox1" Enabled="true"> </ajaxToolkit:CalendarExtender> </EditItemTemplate> <InsertItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("[Expiration Date]") %>'></asp:TextBox> <ajaxToolkit:CalendarExtender Format="MM-dd-yyyy" Id="CalendarExtender1" runat="server" targetcontrolid="TextBox1" Enabled="true"> </ajaxToolkit:CalendarExtender> </InsertItemTemplate> </asp:TemplateField> <asp:BoundField DataField="Notes" HeaderText="Notes" SortExpression="Notes" /> </Fields> </asp:DetailsView>oned_gk
All-Star
31661 Points
6473 Posts
Re: Detailsview Insert is not working with Ajax Calendar Extender
Jan 08, 2013 01:12 AM|LINK
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Expiration_Date") %>'>And make sure the insert parameter name is "Expiration_Date"
And your select command :
SELECT [Expiration Date] as Expiration_Date
chetan.sarod...
All-Star
65789 Points
11153 Posts
Re: Detailsview Insert is not working with Ajax Calendar Extender
Jan 08, 2013 02:37 AM|LINK
Refer this
http://forums.asp.net/t/1295351.aspx/1
http://ritu3001.blogspot.in/2012/02/ajax-calendra-extender-calendarextender.html
http://forums.asp.net/t/1286760.aspx/1
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
spandy
Member
22 Points
24 Posts
Re: Detailsview Insert is not working with Ajax Calendar Extender
Jan 08, 2013 04:49 PM|LINK
oned_gk I changed it like you said but did not work with this also
Edit: Dude, that helped me, I tested this templatefield for other columns and it stopped working for the column names that have spaces so I changed the columns names and it started working like charm! So the the problem here is Eval does allow spaces but Bind does not allow.
http://forums.asp.net/t/1184443.aspx/1 Here I found.
<asp:TemplateField HeaderText="Expiration Date" > <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Eval("ExpDate") %>'></asp:Label> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ExpDate") %>'></asp:TextBox> </EditItemTemplate> <InsertItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ExpDate") %>'></asp:TextBox> <ajaxToolkit:CalendarExtender Format="MM/dd/yyyy" Id="CalendarExtender1" runat="server" targetcontrolid="TextBox1" Enabled="true"> </ajaxToolkit:CalendarExtender> </InsertItemTemplate> </asp:TemplateField>chetan.sarode
I checked those links as well and I have the same code that they have but not working.
I am using Access, will this matter?