Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 7th, 2008, 09:44 AM
Authorized User
 
Join Date: May 2006
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Calling Class within ASPX file

Hi,

I have a CS Class file that creates an XML document called CreateXML.cs. How do I call the function/method within the class to create the XML document from a Page_Load of an ASPX file

The class is called

public class XMLGenerator
{
...
}

Any help greatly appreciated..

Hasta Luego..
KingRoon

DogFightClothing. No dogs. No fighting.
http://www.dogfightclothing.com
__________________
Hasta Luego..
KingRoon

DogFightClothing. No dogs. No fighting.
http://www.dogfightclothing.com
 
Old July 7th, 2008, 11:24 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

First you need to create an instance of the class (unless the method you want to call is static) then you call the method:

XMLGenerator objGenerator = new XMLGenerator();
objGenerator.MethodNameToCall();

-Peter
compiledthoughts.com
 
Old July 8th, 2008, 03:22 AM
Authorized User
 
Join Date: May 2006
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Cheers Peter,

Do you need a reference in the page to the Class file at all? E.g. in the Page directive?

Hasta Luego..
KingRoon

DogFightClothing. No dogs. No fighting.
http://www.dogfightclothing.com
 
Old July 9th, 2008, 07:43 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You don't make references to classes. You reference assemblies, if necessary. For classes in the same assembly, you simply create instances of them.

-Peter
compiledthoughts.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
error ... when calling a class HumaMunir Java Espanol 2 May 7th, 2005 01:09 PM
Calling codebehind C# function from aspx page ravindrasingh77 BOOK: ASP.NET Website Programming Problem-Design-Solution 2 March 16th, 2005 12:08 AM
Calling procedure of User Control from aspx file vskumar VB.NET 1 February 15th, 2005 11:17 AM
Calling a function from .vb file to aspx file !! NitinJoshi General .NET 4 February 10th, 2005 06:23 AM
Basic: Calling variable in ASPX from XML DolphinBay ASP.NET 1.0 and 1.1 Basics 11 April 21st, 2004 09:21 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.