title: Cast an image and change its source dynamically
body: <p>I would like to change an images source based of a link in the database.  I get an obect is not set to to a reference null message some on some of my pages.  Here is the code that i am attempting to use to cast the image. It does work with the commented out code for all pages but about three...the only reason I think it breaks is because those pages use an inherited master page that the logo is located on.  image.Src in the last part of the if statement, it does not have .Src avaliable.  Is there any way to dynamically change an image source?  Thank you!</p>
  
  <pre><code>                if (row.ImageString != "")
                  {
                      //imgLogo.Src = "~" + row.ImageString;
                      Image image = new Image();
                      image.FindControl("imgLogo");
                      image.Src = "~" + row.ImageString; 
                  }
  </code></pre>