lundi 3 août 2015

the best way to handle

I am writing a module(frontend extjs 4.2.1, backend asp.net mvc with the EF). I meet a little problem: when the user clicks the search button, a panel of extjs will be displayed and he/she can fill some blanks inside the textfield. after the filter information was submitted, the sever side will use appropriate c# code to deal with it to filter some records from the mssql database, here is my problem:

if the user inserts nothing into the field, the standard and best practice will be that this field will be neglected, however, the blank textfield's value will be '' which I can not use this as the filter string, for instance: there is a textfield named "sex", if the use types nothing into the field, the value passed to server will be '', if i write the lambda expression in this way: var filter = x=>x.sex ==""; Apparently it will not work. You may say that i can use if-else to condition out the stuff. but if i have numerous fields, using the if-else will be really waste of time. so, what is the best practice to do this




Aucun commentaire:

Enregistrer un commentaire