Reputation: 111
this is my code
string result = ddllist.FindByValue(lstvalueA).Text;
if there is no lstvalueA
in ddllist
,null should be assigned to result
can anyone help on this?
Upvotes: 2
Views: 741
Reputation: 460168
Check if it's null
:
string result = null;
ListItem item = ddllist.Items.FindByValue(lstvalueA);
if(item != null)
result = item.Text;
Upvotes: 3