Object reference not set to an instance of an object.

  • Thread starter Thread starter Arjen
  • Start date Start date
A

Arjen

Hello,

Here is the error message:
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object. (Line 175)

Source Error:

Line 172: private void myDataGrid_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e) {
Line 173: DataRowView drv = (DataRowView) e.Item.DataItem;
Line 174: System.Web.UI.WebControls.Image thumb =
(System.Web.UI.WebControls.Image) e.Item.FindControl("thumbnail");
Line 175: thumb.Attributes.Add("OnClick", "window.close()");

Can somebody help me?

Thanks!
 
Hi,

check that you get Image with "thumbnail" name.

Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
 
<asp:TemplateColumn>
<HeaderStyle CssClass="NormalBold"></HeaderStyle>
<ItemTemplate>
<asp:Image id="thumbnail" name="thumbnail" ImageUrl="<%=
GetBrowsePath((int) DataBinder.Eval(Container.DataItem,'itemId')) %>"
BorderWidth="0" Height="70" Width="100" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>


It still doesn't works.
 
Back
Top