Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Get resource file content on child control page of a module

    • 0
    • 4
    • 2
    • 0
    • 0
    • 0
    • 0
    • 0
    • 278
    Comment on it

    I was facing a problem of not getting content in different control page of a module. I have implemented it in two ways:

    1. 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>
    
    1. 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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: