Click here to Skip to main content
15,901,284 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionwhat the event that is fired when closing the browser window Pin
abdelhameed8130-Oct-06 19:39
abdelhameed8130-Oct-06 19:39 
AnswerRe: what the event that is fired when closing the browser window Pin
just3ala231-Oct-06 1:39
just3ala231-Oct-06 1:39 
Question.NET Best Architecture!!!? Pin
cloudking1196630-Oct-06 18:42
cloudking1196630-Oct-06 18:42 
AnswerRe: .NET Best Architecture!!!? Pin
just3ala231-Oct-06 1:36
just3ala231-Oct-06 1:36 
AnswerRe: .NET Best Architecture!!!? Pin
minhpc_bk31-Oct-06 13:41
minhpc_bk31-Oct-06 13:41 
GeneralRe: .NET Best Architecture!!!? Pin
cloudking119661-Nov-06 19:08
cloudking119661-Nov-06 19:08 
QuestionHow to download text file on client system Pin
asprajesh30-Oct-06 18:15
asprajesh30-Oct-06 18:15 
QuestionAccessing Global Objects in User Controls Pin
GregStevensCA30-Oct-06 13:34
GregStevensCA30-Oct-06 13:34 

I have a question. I have created a class (DBClass) to act as a handler for interactions with a database. Creating an instance of that class opens a connection to the database, and the object then has a number of methods for handing transactions with the database.


Initially, my thought was to include the class definition file (which also creates a single instance of the object, called DB) at the beginning of each document. Then, I thought, I'd be able to reference the DB object anywhere in the page to interact with the database.


So, this is (a simplified version of) what my main page looks like:



<!-- #include virtual="dbclass.aspx" -->
<%@ Register TagPrefix="inc" TagName="title" Src="title.ascx" %>
<html>
 <head>
  <title>Side Bar Template</title>
 </head>
 <body>
  <inc:title runat="Server" />
 </body>
</html>



The dbclass.aspx file contains the code that defines the DBClass class and creates a single instance of that class called DB.



Now, the title.ascx file defines a User Control that prints the title of the page, by looking up the URL of the page in a database and retrieving the corresponding title. That look-up in the database is handled by the DB object:




<%@ Control Language="VB" ClassName="TitleControl" %>
   <h1>
<% 
    Response.Write( DB.GetNameFromUrl( Request.ServerVariables("URL") ) )
%>
   </h1>



But when I run the main page, it gives a compilation error then trying to compile the
Title Control, because I reference the DB object without declaring it inside that file (title.ascx).



Any idea how I can get the user control to be "aware" of the main DB object I've defined in the calling page?



Thanks for any help or insight..



----G
AnswerRe: Accessing Global Objects in User Controls Pin
minhpc_bk30-Oct-06 13:50
minhpc_bk30-Oct-06 13:50 
QuestionReturn XML. Please, need help. Thanks. Pin
shapper30-Oct-06 13:26
shapper30-Oct-06 13:26 
AnswerRe: Return XML. Please, need help. Thanks. Pin
minhpc_bk30-Oct-06 13:54
minhpc_bk30-Oct-06 13:54 
Questionproblem in writing client side script from code behind. Pin
Renukapadhamanaban30-Oct-06 12:43
Renukapadhamanaban30-Oct-06 12:43 
AnswerRe: problem in writing client side script from code behind. Pin
minhpc_bk30-Oct-06 13:59
minhpc_bk30-Oct-06 13:59 
GeneralRe: problem in writing client side script from code behind. Pin
Renukapadhamanaban30-Oct-06 15:30
Renukapadhamanaban30-Oct-06 15:30 
AnswerRe: problem in writing client side script from code behind. Pin
Parwej Ahamad30-Oct-06 20:37
professionalParwej Ahamad30-Oct-06 20:37 
GeneralRe: problem in writing client side script from code behind. Pin
Renukapadhamanaban31-Oct-06 12:21
Renukapadhamanaban31-Oct-06 12:21 
GeneralRe: problem in writing client side script from code behind. Pin
Parwej Ahamad31-Oct-06 16:03
professionalParwej Ahamad31-Oct-06 16:03 
Questionassembly in .net Pin
saravanan0530-Oct-06 11:32
saravanan0530-Oct-06 11:32 
AnswerRe: assembly in .net Pin
minhpc_bk30-Oct-06 14:00
minhpc_bk30-Oct-06 14:00 
QuestionClasses in asp.net Pin
greekius30-Oct-06 11:03
greekius30-Oct-06 11:03 
AnswerRe: Classes in asp.net Pin
minhpc_bk30-Oct-06 14:02
minhpc_bk30-Oct-06 14:02 
GeneralRe: Classes in asp.net Pin
greekius30-Oct-06 20:39
greekius30-Oct-06 20:39 
GeneralRe: Classes in asp.net Pin
minhpc_bk31-Oct-06 0:24
minhpc_bk31-Oct-06 0:24 
QuestionSession_end and variables Pin
eggsovereasy30-Oct-06 10:25
eggsovereasy30-Oct-06 10:25 
AnswerRe: Session_end and variables Pin
Guffa30-Oct-06 11:17
Guffa30-Oct-06 11:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.