This is a migrated thread and some comments may be shown as answers.

GridDateTimeColumn and date format

6 Answers 968 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Torres
Top achievements
Rank 1
Torres asked on 20 Jun 2008, 07:21 AM
Hello,

in a radgrid I am using a GridDateTimeColumn. I am using german culture, the dateformat in the text-box of the timepicker is dd.mm.yyyy - when I select a date e.g. 31. dec. 2008 a error message like "cannot convert string to datetime" appears - when I select 12. dec. 2008 it works. I suppose that there is a problem with the german format of dd.mm.yyyy and the american format mm.dd.yyyy.

this is my code:
<telerik:GridDateTimeColumn PickerType="DatePicker" DataFormatString="{0:dd. MMM yyyy}" UniqueName="ValidTo" HeaderText="ValidTo" DataField="ValidTo" DataType="System.DateTime" /> 

It does not work also without dataformatstring....

Kind regards
Martin

6 Answers, 1 is accepted

Sort by
0
Torres
Top achievements
Rank 1
answered on 20 Jun 2008, 12:46 PM
Hello again,

another problem, maybe similar:

I am using a GridNumericColumn:

 <telerik:GridNumericColumn UniqueName="Price" NumericType="Currency" HeaderText="Price" DataField="Price" /> 

For some reason there occurs an error, when using automatic updates: something like "invalid input format"
The field shows the data from db, e.g.: 12,12 € - when I change the value to 13,12 this error occurs.... (when I change nothing the error occurs too)

[FormatException: Die Eingabezeichenfolge hat das falsche Format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2755599
System.Number.ParseDecimal(String value, NumberStyles options, NumberFormatInfo numfmt) +138
......

Kind regard
Martin
0
Veli
Telerik team
answered on 20 Jun 2008, 03:23 PM
Hello Torres,

In your first post, you wrote you were using a "timepicker" to select a date, I believe you meant a "datepicker", in which case, and also for the problem with the Numeric column, we will need a sample project where we can reproduce the errors you are getting. Please consider opening a regular support ticket and attaching an archive of a small working project, which we can examine to be able to advise you further.

Looking forward to your reply.

Kind regards,
Veli
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Torres
Top achievements
Rank 1
answered on 22 Jun 2008, 10:13 PM
Hi Veli,

yes, as you can see in my code I ment a "DatePicker".
Currenty I don't have the time to create a sample project for your purposes.

Just tell me if these things are tested in the current version of radgrid or if there are known bugs...

Kind regards
Martin
0
Sebastian
Telerik team
answered on 23 Jun 2008, 08:21 AM
Hello Torres,

We are not aware of such issues in the present versions of RadDatePicker/RadInput. I suggest you test the sample projects from the following KB articles:

http://www.telerik.com/support/kb/article/b454K-eme-b454T-cbb-b454c-cbb.aspx
http://www.telerik.com/support/kb/article/b454K-gmg-b454T-cbb-b454c-cbb.aspx

and modify them in order to exhibit the erratic behavior you encountered. Then send the updated versions of the examples attached to a formal support ticket and will do everything possible to address the issues.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Torres
Top achievements
Rank 1
answered on 23 Jun 2008, 09:05 PM
Hello Stephen

your provided sample projects have nothing to do with my problem. I am using the GridDateTimeColumn  - in these  sample projects they are using  gridtemplates.


Okay. Nevertheless I changed my columns to template columns as in the examples.
First: now the datepickers are working, but only if ajax is disabled.... why?
Second: I changed my GridNumericColumn to a template column with RadNumericTextBox inside too. But I am using decimals and textbox type "Currency". And now an error message like "cannot convert double to decimal" occurs:

[ArgumentException: Das Objekt mit dem Typ System.Double kann nicht in den Typ System.Decimal konvertiert werden.]
   System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value) +301
   System.Web.UI.WebControls.ObjectDataSourceView.BuildDataObject(Type dataObjectType, IDictionary inputParameters) +237
   System.Web.UI.WebControls.ObjectDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +1294
   System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +78
   Telerik.Web.UI.GridTableView.PerformUpdate(GridEditableItem editedItem, Boolean suppressRebind) +258
   Telerik.Web.UI.GridCommandEventArgs.ExecuteCommand(Object source) +1302
   Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +130
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
   Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +36
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
   Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +36
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
   Telerik.Web.UI.GridEditFormItem.OnBubbleEvent(Object source, EventArgs e) +308
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
   System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +115
   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +132
   System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +177
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
  
Whats wrong?

Kind regards
Martin

0
plamen
Top achievements
Rank 1
answered on 27 Jun 2008, 07:06 AM
hi

Please review this online example. You can customize and extend the code from the example according to your needs.


Thank you...
<John:Peel />
Tags
Grid
Asked by
Torres
Top achievements
Rank 1
Answers by
Torres
Top achievements
Rank 1
Veli
Telerik team
Sebastian
Telerik team
plamen
Top achievements
Rank 1
Share this question
or