System.NullReferenceException was unhandled by user code using Request.From in VS2008

While excuting the following code  with value for fn = "Location"; I received a System.NullReferenceException was unhandled by user code error and tbLocation was not null in the hidfilter.Value.

string ff = Utils.GetFilterFieldsCSV(Convert.ToInt32(ddTable.SelectedValue));
            hidfilter.Value = ff;
            string filtertxt = "";
           string [] filter = hidfilter.Value.Split(new Char [] {','});
           string itemsinVS = "";
          for(int i=0;i < filter.Length;i++) {
                     string fn = filter[i].ToString();
      string tbfn = "tb" + fn;
      string fv = Request.Form[tbfn].ToString();
      if (fv != "") {
            filtertxt += " " + fn + " LIKE('%" + fv.Trim().Replace("'", "''").Replace(";", "");
+ "%') AND";
                              itemsinVS += fn + ",";
                              ViewState[fn] = fv.Trim().Replace("'", "''").Replace(";", "");
                        else {
                              // remove existing value
                              ViewState[fn] = "";
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

It would help if you indicated where the exception was thrown.

Check the Request.Form collection for "tbLocation".
keithwilson1developerAuthor Commented:
The exception was thrown at
 string fv = Request.Form[tbfn].ToString();
string fv = "";
if (Request.Form[tbfn] != null) {
     fv = Request.Form[tbfn].ToString();

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
keithwilson1developerAuthor Commented:
The problem was created by AJAX extensions but the Guru worked with me and I finally understood that I had to remove them.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.