Trying to populate HTML anchor tag href dynamically, so in my aspx page, I have the following:
<a id="cbphone" runat="server" class="cb-phone" href="#" onclick="clickPhone(409)" >
<asp:ImageButton ID="ImageButton1" runat="server" CssClass="contactButton"
ImageUrl="~/images/phone.png" onclick="ImageButton1_Click" /></a>
and in my cs page I have this:
HtmlAnchor phone = (HtmlAnchor)this.FindControl("cbphone");
phone.HRef = "tel:" + cL.GetBusinessTel(customerid);
Page.Controls.Add(phone);
and I get "Object reference not set to an instance of an object." error on this line, after looking for the html anchor tag:
phone.HRef = "tel:" + cL.GetBusinessTel(customerid);
I have debugged, it does get the tel no.
am I missing something obvious?

New Topic/Question
Reply


MultiQuote



|