最近写了一个关于DIV的显隐功能的页面,遇到了一些问题,已经解决。下面把遇到的问题和解决方案与大家共享。
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
<%
@ 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 >
<! 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 >
< 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