如何在aspx页面中调用函数 [英] how to call function in aspx page
本文介绍了如何在aspx页面中调用函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public void rdbtn_fun(string action, string tbl_names)
{
f1.rdbtn(action, tbl_names);
}
大家好!
我有一个asp.net Web应用程序.
在(.cs)页面后面的代码中,我有一个名为rdbtn_fun
的函数.
f1
是一个类,而rdbtn
是该类的函数.
现在,我如何在JavaScript
下的.aspx页中调用rdbtn_fun
函数.
Hello to all!
I have an asp.net web application.
In code behind (.cs) page I have a function named rdbtn_fun
.
f1
is a class and rdbtn
is function withing that class.
Now how I call rdbtn_fun
function in .aspx page under JavaScript
.
推荐答案
首先,您需要创建对象的类,我假设您的类名称为 ButtonFactory .
例如
Hi,
First of you need to create class of object, i assumed your class name is ButtonFactory.
e.g.
ButtonFactory bf = new ButtonFactory();
其次,您需要使用 ButtonFactory的实例类调用函数.
例如
Second you need to call function using Instance of ButtonFactory class.
e.g.
bf.rdbtn_fun("Action", "TableName")
谢谢,
Imadhusen
Thanks,
Imadhusen
您可以尝试使用Callback或Pagemethod以便直接从客户端(Javascript)调用服务器端方法.
在此处查看: PageMethod示例1 [ PageMethod示例2 [回调示例1 [回调示例2 [
You can either try Callback or Pagemethod in order to call a server side method directly from client side(Javascript).
Look here: PageMethod sample 1[^]
PageMethod sample 2[^]
Callback sample 1[^]
Callback sample 2[^]
这篇关于如何在aspx页面中调用函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文