使用asp.net在页面加载和显示后如何加载事件 [英] How Event Load after page load and display using asp.net

查看:97
本文介绍了使用asp.net在页面加载和显示后如何加载事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在整个页面加载时调用某种方法,并在事件调用此方法时在浏览器上显示
我应该在asp.net上做什么

i want that some method call when whole page load and display on browser when event call this method
what should i do for this in asp.net

protected void Page_Load(object sender, EventArgs e)
{

if page_load = complete
{
call this_method 
}
}

推荐答案

尝试一下.. :)

javascript

try this.. :)

javascript


(窗口).load(函数(){ CallFunction(); }); 函数 CallFunction() {
(window).load(function () { CallFunction(); }); function CallFunction() {


.ajax({ 类型:" , 网址:" // 页面名称/方法名称 contentType:" , 数据:{},// 参数,如果您不想通过. dataType:" , 成功:功能(数据){ alert(" ); // 返回结果 }, 错误:功能(结果){ alert(" ); } }); }
.ajax({ type: "POST", url: "Default.aspx/GetFunction", //Pagename/MethodName contentType: "application/json;charset=utf-8", data: {}, //Parameters if you wan't to pass. dataType: "json", success: function (data) { alert("success"); //Return result }, error: function (result) { alert("error"); } }); }



c#



c#

[WebMethod]
   public static void GetFunction()
   {

       //Your Code for execution

   }


这篇关于使用asp.net在页面加载和显示后如何加载事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆