如何在web方法中调用实例方法,这个web方法我需要调用textbox的onblur事件 [英] how to call instance method in web method and this web method i need to call on onblur event of textbox
本文介绍了如何在web方法中调用实例方法,这个web方法我需要调用textbox的onblur事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public void disp()
{
if (txtbox.Text != "")
{
txtbox.Text = "Hello world";
}
}
[WebMethod]
public static void Disp()
{
}
推荐答案
Raj Wrote:
Raj Wrote:
如何在web方法中调用实例方法?
how to call instance method in web method?
由于webservice是一个静态方法,它只能调用其他静态方法或新对象。
WebMethod:
Since webservice is a static method, it can only call other static methods or new objects.
WebMethod:
[WebMethod]
public static void ResetDate(DateTime TheNewDate)
{
var thisPage = new Test();
thisPage.LoadCallHistory("args");
}
班级:
Class:
Class Test
{
public void LoadCallHistory(string args)
{
//Do your work here
}
}
或
WebMethod :
Or
WebMethod:
[WebMethod]
public static void Disp()
{
disp();//call the static function here
}
类:
Class:
public static void disp()
{
if (txtbox.Text != "")
{
txtbox.Text = "Hello world";
}
}
Raj Wrote:
Raj Wrote:
怎么样使用Javascript调用Web方法?
how to call a web method using Javascript?
检查使用JavaScript从HTML页面调用Web服务 [ ^ ]
希望它有所帮助!
--Amit
Check Calling Web Services from HTML Pages using JavaScript[^]
Hope it helps!
--Amit
查看以下文章:
1. WebService调用 [ ^ ]
2. PageMethod [ ^ ]
您需要将onblur事件与callback / ajax调用联系起来并与方法进行对话。
Have a look at the following articles:
1. WebService call[^]
2. PageMethod[^]
You need to tie the onblur event with the callback/ajax call and talk to the method.
这篇关于如何在web方法中调用实例方法,这个web方法我需要调用textbox的onblur事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文