This is a migrated thread and some comments may be shown as answers.

[Solved] Avoiding "null" on nullable columns

4 Answers 126 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Joao Cardoso
Top achievements
Rank 1
Joao Cardoso asked on 14 Jun 2010, 03:12 PM

Hi there,

My question today is how to avoid the "null" text on columns that are nullable?

Long story short I have a model that looks like this:

  Public Class PriProcesso  
 
        Property Produto As String  
        Property NumeroProcesso As Long  
        Property DataAbertura As DateTime?  
 
    End Class  
 

DataAbertura can assume "nothing" as a value.

When I bind it as a column to the grid like this:

gridBuilder.Columns(Sub(c) c.Bound(Function(b) b.DataAbertura).Format("{0:yyyy-MM-dd}").Width(80).Title("Aberto em")) 

It all works great.... when the field has a value. When its "nothing", the grid shows "null" as the column value.

Is there a way to avoid this? Nullable properties should not come up as "null" when it does not have a value...it  should com up empty instead as this is what we intent to show users 90% of the time.

Cheers

Joao Cardoso

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 14 Jun 2010, 04:47 PM
Hi Joao Cardoso,

Which version are you using? This should not be a problem with the current official release 2010.1.518.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Joao Cardoso
Top achievements
Rank 1
answered on 14 Jun 2010, 05:30 PM
That explains it... I have version 2010.1.309. Thats the version available to download as far as I can see. Any plan on when will the new version will be available on the free download page?

Cheers

Joao Cardoso

0
Accepted
Atanas Korchev
Telerik team
answered on 15 Jun 2010, 07:14 AM
Hi Joao Cardoso,

Service packs are available only to users with commercial license. Occasionally we upload the service pack in a forum thread.

All the best,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Tiago
Top achievements
Rank 1
answered on 25 May 2011, 03:04 PM
Hi, I'm opening this thread again because this was the closest i could find on my problem.

what appens is that when i use format on a column tha comes from a linked table that has the value null i get the error

otherwise,if its from the main table, it works fine

== null -> WORKS
col.Bound(p => p.EndDate).Format(

 

"{0:d}");

== null ERROR - Object reference not set to an instance of an object.
col.Bound(p => p.LoanRevisions.SingleOrDefault(r => r.EndDate ==
null).EndDate).Format("{0:d}"

);


just another thing, this works fine too,obviosly without the correct format:
col.Bound(p => p.LoanRevisions.SingleOrDefault(r => r.EndDate == null).EndDate);


thanks in advance...

 

 

Tags
Grid
Asked by
Joao Cardoso
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Joao Cardoso
Top achievements
Rank 1
Tiago
Top achievements
Rank 1
Share this question
or