Click here to Skip to main content
11,791,059 members (55,857 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: other Calls

I have a CS file in appcode FHAConnClass.cs , now i need to call a method of XMLValidator.aspx.cs file.How can i do that?

namespace FHAConnTester
    public class FHAConnClass
        public string ReadTest()
//I want to call the method of aspx.cs
     requestXML ();


namespace LoanScore
    public partial class XMLValidator : System.Web.UI.Page
       public void requestXML()
        {//Do something

<%@ Page Language="C#"  AutoEventWireup="true" CodeFile="XMLValidator.aspx.cs" Inherits="LoanScore.XMLValidator" Title="XML Validator"   MasterPageFile="~/master/MasterPage.master"%>
Posted 23-Jul-12 21:12pm
VijayChauhan123 at 24-Jul-12 3:21am
Make ur method as Static, and access with the classname and methodname.......
Ali_100 at 24-Jul-12 3:44am
public static void requestXML()
{//Do something
i can't access

was i follow u rightly ? can u tell me the other one?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The easiest way is to move the requestXML function to another class. Methods in your Page class should be events like Load and server control events. Don't put common functionality here. That's bad practice.
You could solve this by using statics, but it's bad architecture.

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

  Print Answers RSS
0 OriginalGriff 1,329
1 Maciej Los 835
2 ppolymorphe 780
3 KrunalRohit 686
4 CPallini 661

Advertise | Privacy | Mobile
Web01 | 2.8.1509028.1 | Last Updated 14 Aug 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100