This project is read-only.

working with dates?

Sep 16, 2011 at 7:58 AM

How do we format date values.

I am working with the Date Picker control, and I need to be able to format the date correctly before binding it to the textbox of the Date Picker control.

The Date value is: Year 1974 Month 12 Day 14

In C# new DateTime(1974, 12, 14)

The format of the Date value I am getting from an ASPX Static WebMethod is:  "/Date(156171600000)/"

I need a way to format this before binding to the Date Picker, and format it back again before binding to the object.  Is there a callback somewhere I can hook?  I didn't find anything in the doco?



Sep 16, 2011 at 11:01 AM
Edited Sep 16, 2011 at 11:15 AM

Hi Scott, you are welcome.

General speaking Json standard date format is very tedious to handle and it requires a big effort not completely justified.

jQXB duty doesn't  consist to handle data format ( date , double , currency etc etc ) but it provides mechanisms to intercept events just before data is bound to controls.

There could be several ways to accomplish your need.

1) If your WebMethod returns only a date value, the simplest way consist of return the date converted directly to String that is the most common format use by HTML controls or plug-ins to handle date.

2) You could add an handler with jQXB.addOnBeforeDataSourceBindhnd in order to manipulate data format before displaying data. Then You should do a corresponding manipulation just before sending data back to the server. You can take a look at jQXB Documentation Section ("How jQXB handles change events") on codeplex to get an example on how to hook an jQXB event and how to write an handling routine.

3) A more general solution that I can suggest you consist in using the viewmodel pattern in order to handle data on UI.

For furthers questions do not hesitate to contact us.


Sep 25, 2011 at 12:49 AM

Hi Scott, most probably the new jqxb-transformfunc attributes can help you to deal with date ( See documentation section about value transformation )


Sep 28, 2011 at 1:36 AM

Hi there,

First of all let me say thanks for making such a great product available for us to use, and thank you for responding so quickly to my queries.  I have been sidetracked on a heap of other work I had to do and am just getting back to this now.

The the new jqxb-transformfunc attributes are great, exactly what we needed.  Currently the Transform Function gets passed the value.  One thing that would make this even more awesome would be to pass a reference to the control, as well.  This way we can write event handlers more generically as we can assign class names that describe the type of control, and write one event handler that can do all the reformatting of values that need to be modified.  Also with ThirdParty Controls sometimes you need to call methods to get the object you want, rather than just the inputs text value etc...  if we get a reference to the input control we can identify what it is via a class, and based on that get a handle on the ThirdParty control object etc...

Again thanks for you time and effort on this project.  Great work.




Sep 28, 2011 at 1:12 PM

Hi Scott,

Thank you for your suggestion, we are considering to insert that feature in the future builds, stay tuned !!!.

In addition we are preparing a section containing users' feedbacks on jQXB official site. We'll very appreciate an your opinion and in which kind of project you are using jQXB as testimonial to publish obviously with your permission.

If you consent to that you could kindly send us your comment on with object "Suggestion" specifyng your name , your role , company(optional),your country and your city(optional)