User-1939834628 posted
I defined a GridView in this way:
<asp:GridView
ID="gvData"
runat="server"
DataSourceID="sdsData"
AutoGenerateColumns="False"
<Columns>
<asp:TemplateField HeaderText="Date">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("event_date","{0:dd/MM/yyyy}") %>' />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtDate" runat="server" Text='<%# Bind("event_date","{0:dd/MM/yyyy}") %>' />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:ImageButton ID="btnDelete" runat="server" ImageUrl="/IMAGES/ico_cancella.gif" CommandName="Delete" CommandArgument='<%# Eval("id") %>' OnCommand="btnDelete_Command" CausesValidation="false" />
<asp:ImageButton ID="btnEdit" runat="server" ImageUrl="/IMAGES/ico_modifica.gif" CommandName="Edit" CommandArgument='<%# Eval("id") %>' OnCommand="btnEdit_Command" CausesValidation="false" />
</ItemTemplate>
<EditItemTemplate>
<asp:ImageButton ID="btnUpdate" runat="server" ImageUrl="/IMAGES/ico_close.gif" CommandName="Update" CommandArgument='<%# Eval("id") %>' OnCommand="btnUpdate_Command" ValidationGroup="vgUpdate" />
<asp:ImageButton ID="btnCancelUpdate" runat="server" ImageUrl="/IMAGES/ico_annulla.png" CommandName="Cancel" OnCommand="btnCancelUpdate_Command" CausesValidation="false" />
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
I cannot update the row since an exception is thrown about date field format.
I tried removing the format qualifier from Bind() call but in such case:
1) the date field is formatted the same way (italian localization) but it contains also hh:mm:ss ...
2) and the update also fails with the same error
The DataSource is an SQLDataSource and the SQL backend is a MySQL server.
Thnx in advance.