Hi
I have a grid with the source of a data table. One of the columns is an integer, unfortunately the data in the database has both zero and null instead of just one or the other. What this means is that I think the grid is happy to bring through the zero but the ultra combo (or value list as I tried that also) does not have a zero. It then displays a 0 in the grid, instead of a blank which is does do when the value in the database is Null.
I want to either update the field in the ultragrid so that if it is zero then display NULL, it should not update the underlying data source but just change the display to blank. Alternatively, do it in the ultracomboeditor.
I did find an item in the forums but the links pointed to a dead end, I think it may need a custom formatter but not sure if that is on the grid or the combo.
Here is a screenshot:
The top row has NULL in the database and the second row has 0 in the database.
The project I am doing is switching the UI from MS Access to Dot Net and I don't want to be having to update tables even though the very easiest fix would be to set any zeros to null in the database.
Thanks
Paul
Hi,
I think this has been posted to the wrong place as it is not related to my original question. Just thought I would let you know so you can repost if needed.
Regards
Please note my original code, specifically this line:typeValues = PhoneNumbersGridView.DisplayLayout.ValueLists.Add( Guid.NewGuid().ToString() );Notice that i'm not creating an empty value list via its constructor, I'm using the ValueLists collection on DisplayLayout to create it.I don't see anywhere that you add claimStatusValueList to grid.DisplayLayout.ValueLists.. this may be your problem.
Hi Mike,
Thanks, I will leave it as is and hope that I don't find any others instances that are harder to sort out. If so then I think the additional column should suffice and if not, well.......expect more questioning :)
Hi Paul,
That sounds like a good solution. You could also do it on the client side by simply putting some kind of layer in between the grid and the actual data. For example, you could get the data from your database into a DataTable/DataSet, but then use UltraDataSource in on-demand mode as a sort've intermediary. That would be a lot of code, though. Another option would be to simply hide the "real" column of data in the grid and then add an additional unbound column to display to the user. And then you could control the contents of that column in code by translating "0" into null and vice versa. This would be a lot less code, but it might be a bit tedious if you have to do this for a lot of columns dynamically.
It's not the answer I was hoping for. I am switching a MS Access UI to dotnet and in MSAccess the zeros and nulls show blank so wanted to replicate this.
I have changed to a stored procedure that returns a null instead for the SELECT command of the dataadapter and that seems to work and I didn't have to change the existing data so will go this route when necessary.