Tuesday, August 6, 2013

Object reference not set to an instance of an object? Search result pagination

Object reference not set to an instance of an object? Search result
pagination

How should this code be written? I am getting Object reference not set to
an instance of an object on if (!query.Keys[i].Contains("ddl"))
for (int i = 0; i < count; i++)
{
if (!query.Keys[i].Contains("ddl"))
url += string.Format("{0}{1}={2}",
i == 0 ? "?" : "&",
query.Keys[i],
query.Keys[i] == "category" ? string.Join("TTT",
query.GetValues(i)).Replace(" ", "+") :
string.Join(",", query.GetValues(i)));
}

No comments:

Post a Comment