In my model I defined NullDisplayFormat
[StringLength(100)]
[DisplayName("First Contact")]
[DisplayFormat(NullDisplayText = "")]
[Column("Contact1",TypeName = "varchar")]
public virtual string Contact1 { get; set; }
In Google Chrome and in FireFox I see nothing in the grid and input controls in my view. However, in IE 9 I see NULL. Is it a bug in IE 9? What is the simplest way to fix it?
I also tried to change null to nothing this way in jQuery:
var Contact1 = $('.trSelected td:eq(3)').text();
$('#Contact1').val(Contact1||'Nothing');
However, it didn’t work since the Contact1 is already a string property = null. Do you know how can I fix it?
Thanks in advance.
The problem was with display in the grid using JSON. So, I revised the code I return, e.g.
Perhaps DisplayFormat only works for the viewing /editing this in a single control, not when we return it as a set. Interestingly Google Chrome and FireFox show NULL as empty string, though.