2

My Client need a DNN module in which the dynamic generated Javascript should appear in the footer of the whole web portal. I have generated the code but it only appears on one page of the portal as soon as the page closes the script gone. as this script generated from a Module and that module is in only one page. so donno what to do with this situation, any Suggestion?

ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239
Syed Fazli
  • 71
  • 5

1 Answers1

0

As you said you need to keep the dynamically generated script in Footer control also.

For that, Can you keep the Literal control in the Footer section. Now, whenever the JavaScript is generated dynamically, you have to keep the information in Session variable.

Like this...

public class SessionCollection
{
  public static String DynamicJavaScript
  {
    get
    {
       return Convert.ToString(HttpContext.Current.Session["DynamicJavaScript"]);
    }
    set
    {
       System.Web.HttpContext.Current.Session["DynamicJavaScript"] = value;
    }
  }
}

As you know the Flow of the Control goes like below.

  1. First Web Page will be executed.
  2. Next Master Page will be executed.
  3. Finally User Control will be executed.

Now, once the Master page will execute, the Session value can be accessed in the Footer Part. I am assuming that the Footer Contents are directly been used in Master Page or another User Control is prepared and used in the Master Page.

Hope this will be useful...

Nilish
  • 1,066
  • 3
  • 12
  • 26