日期:2014-05-20  浏览次数:20885 次

关于atlas和母版页冲突的问题....
我刚发现利用Atlas实现无刷新,只要有母版页就不好使,谁知道为什么? 

我的代码 

MasterPage.master 

C# code
<%@   Master   Language= "C# "   AutoEventWireup= "true "   CodeFile= "MasterPage.master.cs "   Inherits= "a_MasterPage "   %> 

<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> 

<html   xmlns= "http://www.w3.org/1999/xhtml "   > 
<head   runat= "server "> 
        <title> 无标题页 </title> 
</head> 
<body> 
        <div> 
                <asp:contentplaceholder   id= "ContentPlaceHolder1 "   runat= "server "> 
                </asp:contentplaceholder> 
        </div> 
</body> 
</html> 


1.aspx 

C# code
<%@   Page   Language= "C# "   MasterPageFile= "MasterPage.master "   AutoEventWireup= "true "   CodeFile= "1.aspx.cs "   Inherits= "a_1 "   Title= "Untitled   Page "   %> 
<asp:Content   ID= "Content1 "   ContentPlaceHolderID= "ContentPlaceHolder1 "   Runat= "Server "> 

                <form   id= "form1 "   runat= "server "> 
                <atlas:ScriptManager   ID= "ScriptManager1 "   runat= "server "   EnablePartialRendering=true   /> 
                <atlas:UpdatePanel   runat= "server "     ID= "UpdatePanel1 "   Mode= "Conditional "> 
                <ContentTemplate> 
                  <asp:Label   ID= "PartialPostBackLabel "   runat= "server "     /> 
                <asp:Button   ID= "PartialPostBackButton "   runat= "server "   Text= "页面   部分进行回发 "   OnClick= "PartialPostBackButton_OnClick "   /> 
                </ContentTemplate> 
                </atlas:UpdatePanel>   
                        
        </form> 
        
</asp:Content> 



1.aspx.cs 


C# code
using   System; 
using   System.Data; 
using   System.Configuration; 
using   System.Collections; 
using   System.Web; 
using   System.Web.Security; 
using   System.Web.UI; 
using   System.Web.UI.WebControls; 
using   System.Web.UI.WebControls.WebParts; 
using   System.Web.UI.HtmlControls; 

public   partial   class   a_1   :   System.Web.UI.Page 
{ 
        protected   void   Page_Load(object   sender,   EventArgs   e) 
        { 

        } 

        protected   void   PartialPostBackButton_OnClick(object   sender,   EventArgs   e) 
        { 
                PartialPostBackLabel.Text   =   DateTime.Now.ToString(); 
        } 


} 


------解决方案--------------------
解决方法:
将ScriptManager放在母版页, 
在内容页中使用ScriptManagerProxy 。
问题就这么简单!
------解决方案--------------------
在母版页放一个<ScriptManager></ScriptManager>
即可
------解决方案--------------------
同意4楼,将scriptmanager放在母版页。

altas已经是一个过时的名称,现在的名称是asp.net ajax1.0. 建议去下载最新版本。
或者直接用已经集成了ajax的vs2008.