c# - filter string empty value -


how can string empty value got filter ? can see when click on empty string wont got filter ! when click on null value got filter.

filter in name

filter in number

iam using same both code on column name , number

 repositoryitemcombobox repositoryitemcombobox1 = new repositoryitemcombobox();  repositoryitemcombobox repositoryitemcombobox2 = new repositoryitemcombobox();  private void gridview1_customrowcelledit(object sender, customrowcellediteventargs e)     {         gridview view = sender gridview;         (int = 0; < gridview1.rowcount; i++)         {         string name= gridview1.getdatarow(i)["name"].tostring();                     if (!repositoryitemcombobox1.items.contains(name))            {            repositoryitemcombobox1.items.add(name);            }         string number= gridview1.getdatarow(i)["number"].tostring();                     if (!repositoryitemcombobox2.items.contains(number))            {            repositoryitemcombobox2.items.add(number);            }         }     } 

in database name got empty value , number got null value. there problem code? how should modify code? edited iam adding piece of code gives me no , still cant filter

 if (string.isnullorempty(name))             {                 string xa = "";                 if (!repositoryitemcombobox11.items.contains(xa))                 {                     repositoryitemcombobox11.items.add(xa);                 }             } 

name= gridview1.getdatarow(i)["name"].tostring();  

you should not use tostring method directly. because if value null, cause exception.


Comments