Saturday, March 24, 2012

object reference not set to an instance of an object

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.

"Tim" <tim.cavins@.sitel.com> wrote in message
news:dc9a9e04.0307170746.6c43d184@.posting.google.c om...
> 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("\"", """);

0 comments:

Post a Comment