cesark
Programmer
- Dec 20, 2003
- 621
Hi,
I am trying to add some javascript functionality (an onclick event) to a LinkButton column generated by a repeater control, but I receive this error:
Object reference not set to an instance of an object.
Line 76: CType(offers_list.FindControl("of_detail"), LinkButton).Attributes.Add("onclick","return function2();")
This is my code:
And this is the repeater control:
What is wrong?
Thank you
I am trying to add some javascript functionality (an onclick event) to a LinkButton column generated by a repeater control, but I receive this error:
Object reference not set to an instance of an object.
Line 76: CType(offers_list.FindControl("of_detail"), LinkButton).Attributes.Add("onclick","return function2();")
This is my code:
Code:
Sub Page_Load(Sender As Object, E As EventArgs)
CType(offers_list.FindControl("of_detail"), LinkButton).Attributes.Add("onclick","return function2();")
End Sub
And this is the repeater control:
Code:
[b]<asp:repeater ID="offers_list" runat="server">[/b]
<itemtemplate>
<tr>
<td>
<%# DataBinder.Eval(Container.DataItem, "theDate", "{0:d}") %></td>
<td><asp:linkbutton ID="user_page" OnClick="us_pag" Text='<%# Server.HtmlEncode(DataBinder.Eval(Container.DataItem, "company_name")) %>' runat="server"></asp:linkbutton></td>
<td>[b]<asp:linkbutton ID="of_detail" OnClick="details" Text='<%# Server.HtmlEncode(DataBinder.Eval(Container.DataItem, "Offer_title")) %>' runat="server"></asp:linkbutton>[/b]</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "City_name") %></td>
</tr>
</itemtemplate>
</asp:repeater>
What is wrong?
Thank you