I have an issue with webdropdowns. I'm using WebDropDowns in a WebDatagrid via dropdownprovider. The dropdown contains a list of dates. The date format shown in the grid cell is correct, and the data format down in the list part of dropdown list is correct. But the value shown in the dropdown control itself is incorrect. The incorrect date format only shows up when I click on any cell the dropdown column. I uploaded an image of this issue, and hope it can explain better. The image is in this link: http://imgur.com/c5C4Y2E Please help me get the date format fixed.
More detail on my grid set up if it helps with the issue:
I'm using the dropdown in a BoundDataField inside a WebDataGrid. The BoundDataField has these properties set: Key="DropDown" DataFormatString="{0:ddd M/dd}" DataType="System.DateTime"
And the editor control inside the dropdownprovider has these properties set: EditorControl ID="DropDownControl" DisplayMode="DropDownList" ClientEvents-SelectionChanged="Some_Event"
The datasource for the Dropdown control is a dataset with 2 columns, one column has the type DateTime, and dropdown's ValueField is set to this column. The other column in the dataset is type string, it holds the date converted to {0:ddd M/dd} format, and the dropdown's TextField is set to this column.
Thanks,
Dan Ding
Here is the second sample.
Regards
Hi, Dan.
As we have discussed it, I'm attaching two samples that resolve the problem you are having.
The first one is using the code you have shared. The notes for the first sample (WDD_SelectedValueMofidied) are:
Basically it is recommended for ValueField to use a unique value which can be easily bind to the value from the DropDownProvider item list by the WebDataGrid. As for the DataFormatString, on first initialization it will use the TextField value of the DropDownProvider which is correctly set to format "ddd M/dd". Now it won'jt be necessarily to set the text of the items on ItemBound server event.
As you will notice the only things that are have changed are:
- adding a new column which will be used for binding between the Grid and the ddprovider
- changing the Value field of the ddprovider
- and an ItemTemplate column is added, which can be also used with WebDropDown provider depending on client needs.
The second sample (DDPandDPPformatDates) shows another approach - format the Date object on selecting-data level.
Thank you for using our product!
Best regards,
Nikolay Alipiev
Software Developer
Alright, thank you for taking the time to investigate this issue. Please keep me updated on when a fix will be available.
I've tried to add the the DataFormatString="{0:ddd M/dd}" to the Unbound column, but unfortunately it is not working. I've also tried to attach to the grid editing client-site event and inside to format the date, but again with no success.
So I've logged and internal issue in order, to investigate and fix it, or at least to find a proper way to resolve your case. Its development ID is 212479. The next step will be for a developer to review my investigation and confirm my findings or to offer a fix, or other resolution.
I will leave this case open and update you with any new information after the review. You can also continue to send updates to this case at any time. You can view the status of the development issue connected to this case by selecting the "Development Issues" tab when viewing this case on the web site.
I will update you when I locate the reason for that problem, in the context of the grid. Thank you for the patience!