473,395 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Class in .ascx file

Hi,
probably missing something obvious here. I have a user control hot10.ascx
which just contains a repeater, a code behind file hot10.ascx.vb which fills
the repeater from a datareader and a class file class1.vb. The class file
contains a function FixTitle which I need to use to format the data in the
repeater - I can access the function as Class1.FixTitle in the code behind
file but not in the user control which is where I need it.

So my question is - how do I access functions contained in a class file in a
user control? Obviously I could just copy the function to the user control
but surely thats not neccessary?

Cheers,
Jon

Nov 18 '05 #1
2 2121
You have to expose some public interface to access the internal workings of
your usercontrol. You can either define methods and properties that wrap
your object's functionality, or you can make the controls in your
usercontrol public, which can then be accessed directly.

"Jon Spivey" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:es**************@TK2MSFTNGP10.phx.gbl...
Hi,
probably missing something obvious here. I have a user control hot10.ascx
which just contains a repeater, a code behind file hot10.ascx.vb which fills the repeater from a datareader and a class file class1.vb. The class file
contains a function FixTitle which I need to use to format the data in the
repeater - I can access the function as Class1.FixTitle in the code behind
file but not in the user control which is where I need it.

So my question is - how do I access functions contained in a class file in a user control? Obviously I could just copy the function to the user control
but surely thats not neccessary?

Cheers,
Jon


Nov 18 '05 #2
Hi,
thanks for your reply - almost ashamed to post back I just did
<@ import namespace="AppName.Class1"%>
in the user control and all worked fine. Didnt think of this at first
because there's no need to import the class into the code behind file.

Sometimes it's the simplest things.....

Cheers,
Jon
"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:uD**************@TK2MSFTNGP09.phx.gbl...
You have to expose some public interface to access the internal workings of your usercontrol. You can either define methods and properties that wrap
your object's functionality, or you can make the controls in your
usercontrol public, which can then be accessed directly.

"Jon Spivey" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:es**************@TK2MSFTNGP10.phx.gbl...
Hi,
probably missing something obvious here. I have a user control hot10.ascx which just contains a repeater, a code behind file hot10.ascx.vb which fills
the repeater from a datareader and a class file class1.vb. The class file contains a function FixTitle which I need to use to format the data in the repeater - I can access the function as Class1.FixTitle in the code behind file but not in the user control which is where I need it.

So my question is - how do I access functions contained in a class file in a
user control? Obviously I could just copy the function to the user

control but surely thats not neccessary?

Cheers,
Jon



Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Quentin | last post by:
I made a class in an other file than the aspx one. This class is juste an HtmlTable, it looks like a window, and i'd like to add a property to this class as to add an ascx in a cell. My english is...
6
by: Quentin | last post by:
I need to import an *;ascx, as an object, in my class, that is in myclass.vb. How can i do ? i saw the method LoadControl but i can't use it, or maybe i did wrong, if could help me it would be very...
4
by: BH | last post by:
I'm looking at the source code of the ASP.NET forum sample application. It has the "code-behind" classes compiled into a separate DLL, totally separated from the aspx/ascx files. Adding the class...
4
by: Joel Barsotti | last post by:
On certain pages I want to have a user control that is derived not directly from the usercontrol class, but from a class that extends the UserControl class so my objects will have a some...
2
by: s.hong | last post by:
Hello? On the ASP.NET, I can use the class by import declation on the top of page. <%@ page language="vb" explicit="true" aspcompat="false" debug="true"%> <%@ import namespace="System.Data" %>...
6
by: chrisd | last post by:
Heya, I might be going about this in completely the wrong fasion, I am more of a PHP developer, but I am trying to build a collection of classes in ASP.Net to implement in some aspx pages but also...
5
by: Ranginald | last post by:
I am learning C# and asp.net and am trying to create a new utility class. The default code you get from vwd express is: /// <summary> /// Summary description for ddlCode /// </summary>...
1
by: Larry Epn | last post by:
I've created a project from Microsoft's "club.vsi". I don't want inline code so I've separated all aspx and ascx pages into code-behind pages. I'm compiling the project and continue to get this...
3
by: Steven Nagy | last post by:
Hi all, ASP.NET : Framework 2.0 - C# A recent addition to my code generater will create GridView's and ObjectDataSource's in a control (ASCX). So the code gen creates an ascx, ascx.cs,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.