Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
150
What's happending with WebDateTimeEdit DisplayModeFormat?
posted

Hi all,

 I'm using Infragistics 8.2 for ASP.NET and having some difficullty formatting the WebDateTimEdit control. In my scenario I have a UltraWebGrid with a RowEditTemplate, the RowEditTemplate having the WebDateTimeEdit control for the datetime value of the row clicked.

In the column of the grid the date value is formatted as '28/07/2008' ("dd/MM/yyyy") in the grid's InitialiseLayout method. I am trying to keep this format standard for the field. But for some reason the WebDateTimeEdit displays something looking like 'Mon Jul 28 00:00:00 UTC + 1000 2008' regardless of how I try to setup up the control to format it. And the editmask of the WebDateTimeEdit is then in the format '__/__/____' when you try to enter a new value into it.

The WebDateTimeEdit is setup like this: which is the closest that I think suits my purpose, although I have tried different settings (changin datamode and the modeformats, using culture etc.):

<igtxt:WebDateTimeEdit ID="PaymentDate" columnkey="PaymentDate" DataMode="Date" EditModeFormat="dd/MM/yyyy" DisplayModeFormat="dd/MM/yyyy" runat="server" ><ClientSideEvents Initialize="PaymentDate_Initialise" /></igtxt:WebDateTimeEdit> 

 The clientside function setting the WebDateTimeEdit field value is below, setting the WebDateTimeEdit(dd) date to the cell date.

function UltraWebGrid1_BeforeRowTemplateOpenHandler(gridName, rowId, templateId){

    var row = igtbl_getRowById(rowId);

    var dd = igedit_getById(initialiseID);

    dd.value = row.getCell(12).getValue();

}

As far as I can see (by putting alerts in the javascript function to check the values) the WebDateTimeEdit value gets set to the correct date value and the [EditModeFormat] is being enforced. But the WebDateTimeEdit field is not properly enforcing the diplay formatting in the [DisplayModeFormat] property.

Can anyone see anything wrong with my approach or explain why this is coming out the way it is?

 Thanks for any help!

 

 

  • 24497
    posted

    Hi Kramer,

    To set value in editor, you need to use setValue member function.

    var date = row.getCell(12).getValue();
    dd.setValue(date);

    However, date should be the javascript Date object. If you use String instead of Date, then editor will attempt to parse it to Date, though, it will fail, if date comes in format not equal to expected pattern. Parsing also depends on focus/not-focus state of editor and different patterns can be used while converting string to date.

  • 150
    posted

    Hi,

     Forget it everyone, there was a property columnkey="PaymentDate" on the WebDatetimeEdit that did nothing and when removed fixed the problem.

    Cheers.