两个或多个aspx页面想要调用相同的代码隐藏文件 [英] Two or more aspx page Want to call same codebehind file
本文介绍了两个或多个aspx页面想要调用相同的代码隐藏文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有3个aspx页面,例如Emp1.aspx,Emp2.aspx和Emp3.aspx,我想为服务器端编码调用相同的代码,即Employee.aspx.cs
它可以像这样打电话。
i尝试了这个但没有工作
专家,建议我搞定解决方案。
提前致谢。
解决方案
您可以添加名称<$ c的类文件$ c> Employee.cs 然后你可以从页面后面的三个代码中调用类文件的所有方法和函数... :)
员工Dataservice = new Employee();
Dataservice.MethodName();
您可以像这样调用类文件的方法。 :)
I'am having 3 aspx page such as Emp1.aspx,Emp2.aspx and Emp3.aspx, I want to call same code behindfile for serverside coding ie,Employee.aspx.cs
It is possible to call like this.
i tried this but not working
Experts, Suggest me to get a solution.
Thanks in advance.
解决方案
You can add Class file having nameEmployee.cs
and then you can call all methods and function of class file from all of three code behind page... :)
Employee Dataservice = new Employee(); Dataservice.MethodName();
You can call Method of a class file like that. :)
这篇关于两个或多个aspx页面想要调用相同的代码隐藏文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文