Ive been having some trouble trying to get this linq statement to work. I am setting up a search using linq queries. What i want to do is if a search is null or empty, have it ignore that part of the filtering. So what i have set up is many where clauses that short circuit the where clause like so:
tvContent.LoadContent(
Live.Ringtones
.Where(x => cbSeller.SelectedValue== null ||
x.Property.SellerID == (int)cbSeller.SelectedValue)
.Where(x => cbProperty.SelectedValue==null ||
x.PropertyID == (int)cbProperty.SelectedValue)
.Where(x => string.IsNullOrEmpty(tbContentID.Text) ||
x.RingtoneID == ContentID)
.Where(x => string.IsNullOrEmpty(tbContentName.Text) ||
x.RingtoneName == tbContentName.Text).ToList());
But when I do this I keep getting null reference issues. cbProperty, is empty, and selectedValue does show up null when I debug, but it still says there's a null reference issue. What am I doing wrong?