Last post Apr 28, 2012 08:57 PM by Decker Dong - MSFT
Apr 27, 2012 04:16 PM|Yarden|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 11:33 AM|mm10|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 01:20 PM|Yarden|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 01:24 PM|rajanchaudhary|LINK
so the problem must be something else
Apr 28, 2012 04:29 PM|Yarden|LINK
the sequence matters.
if my code tries to use jquery libarary before the reference to it, bugs will occur..
Apr 28, 2012 08:57 PM|Decker Dong - MSFT|LINK
Congratulation！Welcome to our forum next time to share more ideas or solutions……