M
mike
I have the following in a page_load event
Image img = new Image();
img = (Image)
FormView1.Controls[0].NamingContainer.FindControl("Image1");
if (img.ImageUrl.Length < 20)
img.ImageUrl = "images/unavailable.jpg";
The page uses a master page with ContentPlaceHolder1 in which I have
placed FormView1.
FormView1.Controls[0].NamingContainer.UniqueID returns
ctl00$ContentPlaceHolder1.$FormView1
this works fine until placed on the production server at which point it
barfs with:
Object reference not set to an instance of an object.
what would cause this? Maybe the code being in the page_load event?
Perhaps it should be moved to another event? I did try the same code
in the Formview1.PreRender event as well.....same results
Thanks,
Mike
Image img = new Image();
img = (Image)
FormView1.Controls[0].NamingContainer.FindControl("Image1");
if (img.ImageUrl.Length < 20)
img.ImageUrl = "images/unavailable.jpg";
The page uses a master page with ContentPlaceHolder1 in which I have
placed FormView1.
FormView1.Controls[0].NamingContainer.UniqueID returns
ctl00$ContentPlaceHolder1.$FormView1
this works fine until placed on the production server at which point it
barfs with:
Object reference not set to an instance of an object.
what would cause this? Maybe the code being in the page_load event?
Perhaps it should be moved to another event? I did try the same code
in the Formview1.PreRender event as well.....same results
Thanks,
Mike