Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 29, 2012 12:57 AM by Decker Dong - MSFT
Apr 27, 2012 08:16 PM|LINK
Consider the following situation:
for speed issuses this section is at the bottom of the page.
and this is my question:
or maybe my all thinking is worng?
Apr 28, 2012 03:33 PM|LINK
Can't you just place the script in the MasterPage above the ContentPlaceHolder in which the contents of the page and the user control is rendered? Then the js code inside the ContentPlaceHolder will find the references declared in the master page.
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="WebApplication1.UC.Site1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<asp:ContentPlaceHolder ID="head" runat="server">
<form id="form1" runat="server">
var i = 0;
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
<%@ Page Title="" Language="C#" MasterPageFile="~/UC/Site1.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.UC.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
alert(i); //i declared above in MasterPage is 0 here...
Apr 28, 2012 05:20 PM|LINK
sure I can do that. this is how it's done now.
But, my problem is that im not always use this User Control (it is appended to the page dynamically)
Understand now? :)
the perfect solution would be if I could set a the master page in the <%@ Control %> like in a aspx page.
and inside the user control put the JS inside a asp:content in the master page..
Apr 28, 2012 05:24 PM|LINK
so the problem must be something else
Apr 28, 2012 08:29 PM|LINK
the sequence matters.
if my code tries to use jquery libarary before the reference to it, bugs will occur..
Apr 29, 2012 12:57 AM|LINK
Congratulation！Welcome to our forum next time to share more ideas or solutions……