asp.net在用ajax的时候如何弹出对话框
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:updatepanel ID="UP" runat="server">
<ContentTemplate>
<asp:Button runat="server" Text="Button" onclick="Unnamed2_Click" />
</ContentTemplate>
</asp:updatepanel>
</div>
</form>
ASP.NET2.0中AJAX使用新的Manager 类来管理,而不兼容原来的 ClientManager 类 ,所以用response.write("<script>alert('提示:点我了!')</script>")和
this.Client.RegisterClientBlock(this.GetType(), "name", "<>alert('提示:点我了!');</>", true);
Page.Client.RegisterClientBlock(this.GetType(), "name", "<>alert('提示:点我了!);</>", true);
这些方法都是无效的.
可以用以下方法写代码实现
ScriptManager.RegisterStartupScript(UP, UP.GetType(), "", "alert('点我了');", true);
这样就可以实现了!
//UP是updatepanel 的ID
转自http://www.csharp360.com/bbs/viewthread.php?tid=233&extra=
相关文档:
<html>
<body>
<script type="text/javascript">
function ajaxFunction()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Inte ......
在《Pragmatic Ajax A Web 2.0 Primer 》中偶然看到对readyStae状态的介绍,感觉这个介绍很实在,摘译如下:
0: (Uninitialized) the send( ) method has not yet been invoked.
1: (Loading) the send( ) method has been invoked, request in progress.
2: (Loaded) the send( ) method has completed, entire respons ......
最近做保存远程图片时候,就在保存的时候总是出这个错误,网上google了一圈,都是再说权限问题,问题我是用U盘,哪里有什么权限问题。
最后无意中发现了问题所在
保存的时候不能用相对路径,一定要用server.mappath()处理一下保存的路径。。。唉! ......
1. 虽然是.net,但是已经几乎完全放弃了服务器控件,取而代之的是html控件,赋值时候可以通过注册javascript脚本来完成。只是学习途中的一个实践,不知道这样会不会减少编译,增加运行效率。
2. 推荐跟JQuery结合,NND,这丫真的很强大...如果你跟我一样是js小白,又想NB一把弄个AJAX什么的,用JQuery把。。。这孩子包你满 ......