0

I have infragistics2 v10.3.

I have ultra grid with two columns

|String|DateTime|

For DateTime I have custom formatting like "dd.MM.yyyy HH:mm" System Regional settings have short Date format like "dd-MMM-yy".

So grid shows 07.02.2013 14:00 and user See this.

The sytem have 07-Feb-13

When i want to filter all columns with text "fe" it is also shows me all rows which contains 07.02.2013.

During filtering it uses own formating and ignores my custom
In InitializeLayout event we have done the following code to set date format for the StartDate column

e.Layout.Bands(0).Columns("StartDate").Style = Win.UltraWinGrid.ColumnStyle.Date
e.Layout.Bands(0).Columns("StartDate").Format = "dd/MM/yyyy"
e.Layout.Bands(0).Columns("StartDate").ButtonDisplayStyle = UltraWinGrid.ButtonDisplayStyle.Always

This date field column filter displaying based on Local system date format in opened calendar. Please suggest me where I am doing wrong

Sharanamma Jekeen
  • 109
  • 1
  • 3
  • 18

2 Answers2

0

As your are using string column type to store dates, I suspect how the dates are converted: 07/08/2015 is treated as August 7 or July 8?

You are setting the format for your grid but the data loaded in the DropDown may be in its original form as in the Database.

If you do not want to change the data type of your date column, I would advise that you set DateFormat within the select query as demonstrated in change-data-type-of-data-retrieved-by-select-query (but beware of the conversion errors or the date change scenario as pointed above)

If you are using SQL Server (I'm not sure about other databases) you can use a UDF (User Defined Function) in the select query as in this example of UDF on TechNet or this post on SO: using-udf-in-select-statement

Along with that don't forget to set the Format of your DropDown, if defined explicitly on initialize or on entering edit mode.

Community
  • 1
  • 1
haraman
  • 2,744
  • 2
  • 27
  • 50
  • In database(table) we are saving in the format of DATETIME, but while creating column in ultrawingrid we have defined it as string datatype. mainly this issue is happening in the grid itself on open calendar, & no extra calendar is added for date selection. – Sharanamma Jekeen Nov 17 '15 at 10:30
  • Any particular reason to define it as string? – haraman Nov 17 '15 at 10:31
  • Previously i didn't new the concept so we defined like column as string & now we are unable to change the datatype for the column & if we change then default data source is setting but we don't want that, pragmatically we are adding row to grid. – Sharanamma Jekeen Nov 17 '15 at 10:37
  • You need to provide more details. Are you using `UltraDropDown` or `UltraCombo` in `RowEditTemplate` or the other mode to edit. Try to include some sample code related to your `StartDate` column and attached DropDown, if any. – haraman Nov 17 '15 at 11:50
  • Meanwhile, if you are using UltraDropDown in RowEditTemplate you can try setting its Format too e.g. `Me.UltraDropDown1.DisplayLayout.Bands(0).Columns("StartDate").Format = "dd/MM/yyyy"` – haraman Nov 17 '15 at 11:53
0

You need to set MaskInput property of the column like this:

e.Layout.Bands(0).Columns("StartDate").MaskInput = "dd/mm/yyyy";

Keep in mind when cell is in edit mode it uses an editor to display the edited value. So when you need to fix anything in edit mode you need to fix it in the editor.

wnvko
  • 1,985
  • 1
  • 14
  • 18