I need help with this, I'm trying to set the "display:none" into "display:block" in my div tag which is in the Content Page. When i do the code below, the HtmlGenericControl class keeps on giving error "Object reference not set to an instance of an object" because he can't find the "divSignin" (the id of my div tag) but it's there as presented in the code: Please help.
Is something wrong with my implementation of HtmlGenericControl?
Here's the code in my Content page:
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="col-md-4" id="divSignin" style="display:none" runat="server">
</div>
</asp:Content>
And Here's my code behind in my Master Page:
protected void lbtnRegister_Click(object sender, EventArgs e)
{
HtmlGenericControl myObject = Master.FindControl("ContentPlaceHolder1").FindControl("divSignin") as HtmlGenericControl;
//HtmlGenericControl myObject;
// myObject = (HtmlGenericControl)ContentPlaceHolder1.FindControl("divSignin");
// myObject.Style.Add("display", "block");
}
The comment part in code behind is the other thing i tried which returns the same thing (Null).