Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is there a way to automatically treat null as '' ?
Message
 
 
Information générale
Forum:
ASP.NET
Catégorie:
MVC
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01554434
Message ID:
01555126
Vues:
46
>>Try the DisplayFormat attribute with NullDisplayText set to an empty string: http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.displayformatattribute.aspx
>
>Rob,
>
>Google Chrome and FireFox display empty string when the value is null while IE 9 displays null and also for some reason doesn't display images for the buttons.
>
>I found this answer http://stackoverflow.com/questions/476436/null-coalescing-operator-for-javascript but it's not exactly clear to me.
>
>If I have a value =null and I want to replace it with an empy string, how will it behave? According to that answer, both null and empty string are the same in JavaScript.
>
>I have this code
>
> $('#Contact1').val($('.trSelected td:eq(3)').text());
>
>and I am wondering if I should try
>
> $('#Contact1').val(($('.trSelected td:eq(3)').text()||''));
>
>BTW, this didn't work, since the value is already a string 'null' not the null. May be instead of text in the above I need to use val()

Is there any way to convert NULL in this piece of code?
 var flexgrid = new
            {
                page = page,
                total = Total,
                rows = clients
                .Select(x => new
                {
                    id = x.Id,
                    cell = new {x.Id, x.Number, x.Name, x.Contact1 }
                }
                )

            };
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform