Click here to Skip to main content
15,894,546 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
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.
Posted
Updated 17-Jul-14 20:16pm
v3
Comments
SRS(The Coder) 18-Jul-14 0:50am    
What is your purpose of using three different Emp aspx file here ?
If it is for different employee to display data then you can achieve the same with one aspx file as well. Or else you can use a class file which can be called from all aspx files.
Please elaborate more regarding your requirements so that it will be easier for us to help you out.
[no name] 18-Jul-14 0:54am    
All three aspx files are related with employee details.
Want to achieve single codebehind file for the server side coding
SRS(The Coder) 18-Jul-14 1:13am    
Why don't you using a single EmployeeDetail page and display details as per the ID is being passed to it as query string or anything else state management value ?
[no name] 18-Jul-14 1:18am    
No,the need is 3 ui and one codebehind that's all
SRS(The Coder) 18-Jul-14 1:36am    
Then you have to go for a class file separately call the methods in code behind for each..

1 solution

You can add Class file having name Employee.cs and then you can call all methods and function of class file from all of three code behind page... :)

C#
Employee Dataservice = new Employee();
Dataservice.MethodName();


You can call Method of a class file like that. :)
 
Share this answer
 
Comments
[no name] 18-Jul-14 0:49am    
Could you make it in detail manner
Atyant Srivastava 18-Jul-14 1:12am    
As suggested by Nirav you can call above method in your page load event(or whatever event you wants to call it). Save the data in some collection and then fill the appropriate controls with the same.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900