PC Review


Reply
Thread Tools Rate Thread

Can you use constants in .aspx files?

 
 
Bob Rosen
Guest
Posts: n/a
 
      18th Jul 2003
In InterDev, I frequently defined constants for my data-table field names,
then used #include statements to refer to the file(s) with those
declarations and substituted the constant declaration in any place where I
needed to refer to the field name. Is there any way to do the same sort of
thing in the <%# Container.DataItem (<field name>) %> references inside
..aspx files, for example, when creating DataLists (i.e. use a string
constant instead of a hard-coded string)?

Bob Rosen


 
Reply With Quote
 
 
 
 
John Timney \(Microsoft MVP\)
Guest
Posts: n/a
 
      18th Jul 2003
Why not just add them to the application object, or put them in web.config
and read them in from there. Or you can code your global.asax as a class
and use shared (static) values accesible from anywhere in your web app..

<%@ Application Classname="MyGlobals" %>
<script language="VB" runat="server">

public shared UserCount as integer = 1

Sub Application_OnStart()
End Sub

Sub Session_OnStart()
End Sub

Sub Session_OnEnd()
End Sub

Sub Application_OnEnd()
End Sub
</script>


--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Bob Rosen" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In InterDev, I frequently defined constants for my data-table field names,
> then used #include statements to refer to the file(s) with those
> declarations and substituted the constant declaration in any place where I
> needed to refer to the field name. Is there any way to do the same sort

of
> thing in the <%# Container.DataItem (<field name>) %> references inside
> .aspx files, for example, when creating DataLists (i.e. use a string
> constant instead of a hard-coded string)?
>
> Bob Rosen
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Studio only debugs javascript in .js files not .aspx files Phil Johnson Microsoft ASP .NET 8 31st Jan 2008 12:55 PM
Visual Studio 2005 has stopped generating the *.designer.vb files for *.aspx and *.ascx files Nathan Sokalski Microsoft ASP .NET 1 15th May 2007 04:17 AM
design question about the use of constants and resource files gabriel Microsoft C# .NET 4 17th Oct 2005 08:52 PM
integer constants used with string constants Eric Newton Microsoft Dot NET Framework 3 14th Jan 2004 05:05 AM
Specifying all files except Login.aspx and Join.aspx are restricted to authenticated users SamIAm Microsoft ASP .NET 1 4th Dec 2003 02:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:36 AM.