Click here to Skip to main content
11,920,211 members (47,630 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 22: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
0 OriginalGriff 455
1 phil.o 170
2 CPallini 150
4 F-ES Sitecore 130
0 OriginalGriff 6,778
1 KrunalRohit 4,495
2 Sergey Alexandrovich Kryukov 3,153
3 George Jonsson 2,810
4 Suvendu Shekhar Giri 2,181

Advertise | Privacy | Mobile
Web02 | 2.8.151120.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