object reference not set to an instance of an object

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

My code is posted below. I am getting the error shown in the subject
on the last line that does the Replace method. I've verified that the
hidden field exists on the form itself.

I am not sure why this is happening.

Any help would be appreciated.

-Tim

string strCreateView;
protected HtmlInputHidden hdnOrigCreateView;

//create the view for the search
strCreateView = "CREATE VIEW #Test AS ";
strCreateView += "SELECT FileIndex, DocTitle, vpath, filename, size,
write, characterization, rank ";

strCreateView += "FROM SCOPE(' DEEP TRAVERSAL OF ( " + strScope + " )
')";

//store the create view statement in the form
//replace all quotes with its ascii equivalent
hdnOrigCreateView.Value = strCreateView.Replace("\"", """);
 
Is the hidden field set to runat="server"? If not, then that is why you are
getting that. Also, not only does it have to be set to runat server, it also
has to be declared in the code-behind.

HTH,

Bill P.
 
Back
Top