IvanGB
asked on
Infragistics UltraGrid - how to display #1/1/1800# as blank ( as if null )
Hi all.
My UltraGrid uses a bindingsource. All datetimes which are null in SQL Server are delivered to the bindingsource as #1/1/1800#
I would like Ultrawingrid to display this date as blank as it would a null from source.
Also, if the date is null in the grid ( i.e. blanked out ) I would like to update the data source to the date #1/1/1800# ( the framework takes care of getting that date back into the backend as a null )
This seems like it should be a trivial matter but I can find no documentation on just where to intervene so the grid will see a particular date as a null and save a null as a particular date.
Thanks in advance.
My UltraGrid uses a bindingsource. All datetimes which are null in SQL Server are delivered to the bindingsource as #1/1/1800#
I would like Ultrawingrid to display this date as blank as it would a null from source.
Also, if the date is null in the grid ( i.e. blanked out ) I would like to update the data source to the date #1/1/1800# ( the framework takes care of getting that date back into the backend as a null )
This seems like it should be a trivial matter but I can find no documentation on just where to intervene so the grid will see a particular date as a null and save a null as a particular date.
Thanks in advance.
ASKER
Sorry Ged325, I probably wasn't very clear on my question. But thanks for the attention.
so is this still an issue?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
one simple solution is to take blank(null) from database by use case statement, as it is best practice to have business logic on database itself.
ASKER
Thank you rajeshjamnadas, not an option at my scenario.
If you are binding to datatable, you can use for each dr as DataRow in dt.Select("Date='1/1/1800' ")
dr("Date") = DBNull.Value.
or you can modify that property get part if value='1\1'1800' return nothing sort of.
If above two are not feasible than I think what you have done is more appropriate.
dr("Date") = DBNull.Value.
or you can modify that property get part if value='1\1'1800' return nothing sort of.
If above two are not feasible than I think what you have done is more appropriate.
ASKER
I am binding to a business binding source, and the business object property is set to not accept nulls, so I wouldn't be able to make the date property become null, at the same moment that I need to show it blank at the grid. And I also need to let the user blank it, which doesn't work as the property is set to not accept null. I know, it is just a matter of taking care of what is shown and what is entered, I just couldn't do it with the bound date column. The unbound gave me the freedom to deal with it and send whatever I want back to the table.
if so you could say
if Date is nothing then
MyTextBox.Text = ""
end if
(or label depending on what you're using)