I have some controls on a page and i am not able to access the controls in code behind, it is coming in scientific intelligence. I am getting the cause of that.
here is my HTML code of web control:
<%@ Control Language="c#" AutoEventWireup="false" Inherits="DNNInfo.Modules.Classifieds.Controls.CompanyClassifiedList" %>
<div id="divDetailsDownloadFile" runat="server" class="DNNInfo_ClassifiedDownloads" visible="false">
<asp:LinkButton ID="linkDownloadFile" Text="Download File" runat="server" />
</div>
i am talking about the linkbutton here.
here is code behind code:
namespace DNNInfo.Modules.Classifieds.Controls
{
public class CompanyClassifiedList : PortalModuleBase
{ override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
try
{
this.Load += new System.EventHandler(this.Page_Load);
LinkButton linkDownload_File = (LinkButton)this.FindControl("linkDownloadFile");
if (linkDownload_File != null)
{
linkDownload_File.Click += new EventHandler(this.linkDownloadFile_Click);
}
}
catch (Exception ex)
{
}
}
}
}
It always return null in "linkDownload_File". i am not able to recognize the error. what is the cause for this behavior.
any help will be appreciated.
UPDATE: i have checked by made div visible.. but still its returning null