ASP.NET AJAX注意要点3

最近写了一个关于DIV的显隐功能的页面,遇到了一些问题,已经解决。下面把遇到的问题和解决方案与大家共享。
<% @ Page Language = " C# "  AutoEventWireup = " true "  CodeFile = " ChangeVisibility.aspx.cs "  Inherits = " ChangeVisibility "   %>

<! 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 > Change Visibility </ title >
</ head >
< body >
    
< form id = " form1 "  runat = " server " >
    
< div >
        
< asp:ScriptManager ID = " ScriptManager1 "  runat = " server " >
            
< Scripts >
                
< asp:ScriptReference Assembly = " Microsoft.Web.Preview "  Name = " Microsoft.Web.Resources.ScriptLibrary.PreviewScript.js "   />
                
< asp:ScriptReference Assembly = " Microsoft.Web.Preview "  Name = " Microsoft.Web.Resources.ScriptLibrary.PreviewGlitz.js "   />
                
< asp:ScriptReference Assembly = " Microsoft.Web.Preview "  Name = " Microsoft.Web.Resources.ScriptLibrary.PreviewDragDrop.js "   />
            
</ Scripts >
        
</ asp:ScriptManager >
    
</ div >
        
< div id = " Panel "  style = " width: 100px; height: 100px " >
            This 
is  the text that  is  going to be made invisible
        
</ div >
        
< input id = " Button1 "  type = " button "  value = " button "   />
    
</ form >
    
< script language = " javascript "  type = " text/javascript " >
        var g_panel;
        function pageLoad()
        
{
            
// Set up the atlas panel and set up the initial css
            g_panel = new Sys.UI.Control($get('Panel'));
            g_panel.initialize();
//            g_panel.set_cssClass('normal');

            var btnVisibility 
= new Sys.Preview.UI.Button($get('Button1'));
            btnVisibility.initialize();
            btnVisibility.add_click(onSetVisibilityClick);
        }

        
        function onSetVisibilityClick() 
        
{
            g_panel.set_visible(
!g_panel.get_visible());
        }

    
</ script >
    
</ body >
</ html >
 
< system.web >
        
< pages >
            
< controls >
                
< add tagPrefix = " asp "   namespace = " Microsoft.Web.UI "  assembly = " Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 " />
                
< add tagPrefix = " asp "   namespace = " Microsoft.Web.UI.Controls "  assembly = " Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 " />
        
< add tagPrefix = " asp "   namespace = " Microsoft.Web.Preview.UI "  assembly = " Microsoft.Web.Preview " />
        
< add tagPrefix = " asp "   namespace = " Microsoft.Web.Preview.UI.Controls "  assembly = " Microsoft.Web.Preview " />
            
</ controls >

1、在Beta2中,原先的Sys.UI->Sys.Preview.UI,但对于DIV,则还是使用Sys.UI。
2、原先的$('Button1')->$get('Button1')
3、添加Microsoft.Web.PreView.dll
4、在WebConfig中确保有第二段代码的倒数第二、三行
5、在ScriptManager添加脚本引用
6、原先的Button.click.add->Button.add_click
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值