I was facing a problem of not getting content in different control page of a module.
I have implemented it in two ways:
- Register module in skin instead of dropping a module in a page and give id="view" rather than any other id
<%@ Register TagPrefix="dnn" TagName="SEARCH" Src="~/DesktopModules/SearchModule/View.ascx" %>
<dnn:SEARCH id="view" runat="server"></dnn:SEARCH>
- If we have many control page in a module then register a module in skin and do not provide any id to it
<%@ Register TagPrefix="dnn" TagName="SEARCH" Src="~/DesktopModules/SearchModule/View.ascx" %>
<dnn:SEARCH runat="server"></dnn:SEARCH>
then write the below mentioned code in the module registered.
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
string FileName = System.IO.Path.GetFileNameWithoutExtension(this.AppRelativeVirtualPath);
if (this.ID != null)
//this will fix it when its placed as a ChildUserControl
this.LocalResourceFile = this.LocalResourceFile.Replace(this.ID, FileName);
else
// this will fix it when its dynamically loaded using LoadControl method
this.LocalResourceFile = this.LocalResourceFile + FileName + ".ascx.resx";
}
0 Comment(s)