Ramco Ramco

Ramco Ramco

  • 419
  • 3.4k
  • 527.7k

Object reference not set to an instance of the Object

Jun 17 2023 4:46 AM

Hi

  In below code i am getting above error - img.ImageUrl = objBook.ThumbImage;

var img = e.Item.FindControl("imgThumb") as System.Web.UI.WebControls.Image;
BALBooks bALBooks = new BALBooks();
BookDetail objBook = bALBooks.GetBookList(Convert.ToInt32(hdfBookId.Value));
if (objBook != null)
{
    if(objBook.ThumbImage != null)
        img.ImageUrl = objBook.ThumbImage;
}
<td class="text-center">
    <img id="imgThumb" style='height: 65px;' runat="server" /></td>
<td>

Thanks


Answers (4)