Click here to Skip to main content
13,148,103 members (73,650 online)
Rate this:
Please Sign up or sign in to vote.
See more: (untagged)

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 24-Jul-12 3:21am
Make ur method as Static, and access with the classname and methodname.......
Ali_100 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
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170924.1 | Last Updated 14 Aug 2012
Copyright © CodeProject, 1999-2017
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