关天asp.net ajax beta中在updatepnael中注册脚本的解决方案
点击次数:37 次 发布日期:2008-11-26 11:39:30 作者:源代码网
|
源代码网推荐 参数详解: 源代码网推荐 control (Control) :这个参数是注册脚本块的控件.如果你是在updatepanel中注册时,即updatepanel (应该写updatepanel的ID). 源代码网推荐 type (Type) :这个参数是注册脚本块控件的类型,即updatepanel的类型。 源代码网推荐 key (String) :这个参数是脚本酷块的惟一标识(关键字) 源代码网推荐 script (String) :这个参数是要注册的脚本字符串. 源代码网推荐 addScriptTags (Boolean) :这个参数表示是否要在您的字符串两边使用“<script>”和“</script>”包围起来. 源代码网推荐 源代码网推荐 然后这是我写的一个简单的例子: 源代码网推荐 源代码网推荐 Html代码: 源代码网推荐 <html xmlns="http://www.w3.org/1999/xhtml"> 源代码网推荐 <head runat="server"> 源代码网推荐 <title>Untitled Page</title> 源代码网推荐 <link href="/aspnet_client/System_Web/2_0_50727/CrystalReportWebFormViewer3/CSS/default.css" 源代码网推荐 rel="stylesheet" type="text/css" /> 源代码网推荐 </head> 源代码网推荐 <body> 源代码网推荐 <form id="form1" runat="server"> 源代码网推荐 <asp:ScriptManager ID="ScriptManager1" runat="server" /> 源代码网推荐 <asp:UpdatePanel ID="UpdatePanel1" runat="server" > 源代码网推荐 <ContentTemplate> 源代码网推荐 <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /> 源代码网推荐 </ContentTemplate> 源代码网推荐 </asp:UpdatePanel> 源代码网推荐 </form> 源代码网推荐 </body> 源代码网推荐 </html> 源代码网推荐 源代码网推荐 CS代码: 源代码网推荐 protected void Button1_Click(object sender, EventArgs e) 源代码网推荐 { 源代码网推荐 ScriptManager.RegisterClientScriptBlock(UpdatePanel1, typeof(UpdatePanel), "test", "alert("test");", true); 源代码网推荐 源代码网推荐 } 源代码网推荐 源代码网推荐 以上是我的理解,如果有不正确的地方,请大家纠正,我先放到首页,其实没有什么技术含量,主要是用来让那些还不知道如何注册的朋友看到.过后dohu可以删了。 源代码网推荐 http://www.cnblogs.com/sunlife/archive/2006/11/05/550520.html 源代码网推荐 源代码网推荐 做人要厚道,请注明转自酷网动力(www.ASPCOOL.COM)。 源代码网推荐 源代码网供稿. |
