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

Client Databind Fails/Hangs with DataFormatString {0:g}

3 Answers 41 Views
Grid
This is a migrated thread and some comments may be shown as answers.
LeBear
Top achievements
Rank 1
LeBear asked on 23 Feb 2011, 12:11 AM
I have a RadGrid where one of the columns binds to a date/time value.  I use a GirdDataBound column and it binds correctly on the server.  Using the same source for the data, this fails when I try to bind on the client.  It shows the first record, then just stops. The lines that follow in the Javascript function do not execute.

I removed the DataFormatString and it worked. 

To work around this, I changed the column to a string and formatted it before sending it out to be bound.

I know I'll trip on this again some day (probably soon), so I'd like to get a resolution.

Thanks.

3 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 28 Feb 2011, 08:30 AM
Hello,

This happens because javascript does not support the format strings that the .NET framework does. You can learn more on date formatting in javascript from this blog post:
JavaScript Date Format

Greetings,
Tsvetina
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
LeBear
Top achievements
Rank 1
answered on 28 Feb 2011, 06:19 PM
Understood, but don't you see this as a failure on the RadGrid?  I would imagine that it shouldn't attempt to re-bind on the client using the server-side format string if it's known not to be compatible and that it might cause a failure. 

Is there a workaround in that I can provide a server-side format string and a client-side format string?

Thank you.
0
Tsvetina
Telerik team
answered on 07 Mar 2011, 10:40 AM
Hello,

In order to inspect the issue further and see if it is a bug we would need to debug a runnable project and see what happens during the execution of the script. If you want us to go on investigating this, please provide us with a sample project replicating the described issue.

As for a work-around, you can consider using a format string which is also recognizable by javascript, like, for example {0:d}.

All the best,
Tsvetina
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Grid
Asked by
LeBear
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
LeBear
Top achievements
Rank 1
Share this question
or