Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Wed, 27 Aug 2008 22:19:56 -0400,    group: microsoft.public.dotnet.framework.aspnet        back       


Executing a var within an aspx .inc file?   
All,
How do you write out a variable in a ASPX .inc?? I've used the following in 
my code and it worked until I changed the date & MyWebSite, to a server side 
write... is there any way of getting this to work within an inc file 
structure? Thanks in advance. - CES
        <%
            Response.WriteFile("Yourfile.FileExtension");
        %>
----- Yourfile.FileExtension ------
<div id="copyright">
Copyright  <%=DateTime.Now.Year.ToString()%> - <%=MyWebSite%> - All rights 
reserved.
<br />Use of this site signifies the users complete agreement to all terms, 
contained
<br />& described within the Terms of Use page (Updated July 31, 2008)
</div>
date: Wed, 27 Aug 2008 22:19:56 -0400   author:   CES

Re: Executing a var within an aspx .inc file?   
Why create include files in ASPX. It is much easier to derive from the Page 
class and have your pages derive from that class. You can then have 
something the same in every page that needs it.

There are other ways to set up global FUD, of course. I am not sure #Include 
is my first option. It is probably my last.

-- 
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box!                               |
********************************************
"CES"  wrote in message 
news:OmJTPSLCJHA.1224@TK2MSFTNGP02.phx.gbl...
> All,
> How do you write out a variable in a ASPX .inc?? I've used the following 
> in my code and it worked until I changed the date & MyWebSite, to a server 
> side write... is there any way of getting this to work within an inc file 
> structure? Thanks in advance. - CES
>        <%
>            Response.WriteFile("Yourfile.FileExtension");
>        %>
> ----- Yourfile.FileExtension ------
> <div id="copyright">
> Copyright  <%=DateTime.Now.Year.ToString()%> - <%=MyWebSite%> - All rights 
> reserved.
> <br />Use of this site signifies the users complete agreement to all 
> terms, contained
> <br />& described within the Terms of Use page (Updated July 31, 2008)
> </div>
>
>
date: Wed, 27 Aug 2008 22:29:35 -0500   author:   Cowboy \(Gregory A. Beamer\) oSpamM

Re: Executing a var within an aspx .inc file?   
Thanks for not answering my question... I'm just switch over to .net from 
classic asp and as much as possible I'm trying to take small steps with 
concepts I've used in the past and what you just stated doesn't mean 
anything to me... yet!


"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@comcast.netNoSpamM> wrote in 
message news:eeizM5LCJHA.4884@TK2MSFTNGP02.phx.gbl...
> Why create include files in ASPX. It is much easier to derive from the 
> Page class and have your pages derive from that class. You can then have 
> something the same in every page that needs it.
>
> There are other ways to set up global FUD, of course. I am not sure 
> #Include is my first option. It is probably my last.
>
> -- 
> Gregory A. Beamer
> MVP, MCP: +I, SE, SD, DBA
>
> Subscribe to my blog
> http://feeds.feedburner.com/GregoryBeamer#
>
> or just read it:
> http://feeds.feedburner.com/GregoryBeamer
>
> ********************************************
> | Think outside the box!                               |
> ********************************************
> "CES"  wrote in message 
> news:OmJTPSLCJHA.1224@TK2MSFTNGP02.phx.gbl...
>> All,
>> How do you write out a variable in a ASPX .inc?? I've used the following 
>> in my code and it worked until I changed the date & MyWebSite, to a 
>> server side write... is there any way of getting this to work within an 
>> inc file structure? Thanks in advance. - CES
>>        <%
>>            Response.WriteFile("Yourfile.FileExtension");
>>        %>
>> ----- Yourfile.FileExtension ------
>> <div id="copyright">
>> Copyright  <%=DateTime.Now.Year.ToString()%> - <%=MyWebSite%> - All 
>> rights reserved.
>> <br />Use of this site signifies the users complete agreement to all 
>> terms, contained
>> <br />& described within the Terms of Use page (Updated July 31, 
>> 2008)
>> </div>
>>
>>
>
date: Thu, 28 Aug 2008 00:09:53 -0400   author:   CES

Re: Executing a var within an aspx .inc file?   
"CES"  wrote in message 
news:%23MhTrPMCJHA.1628@TK2MSFTNGP03.phx.gbl...
> Thanks for not answering my question...

- I'd say he did.

> I'm just switch over to .net from classic asp and as much as possible I'm 
> trying to take small steps with concepts I've used in the past

- Maybe that is your problem

> and what you just stated doesn't mean  anything to me... yet!

- So it is Gregorys fault you don't understand? Hmm..

//Michael Starberg
date: Thu, 28 Aug 2008 07:49:00 +0200   author:   Michael Starberg

Re: Executing a var within an aspx .inc file?   
"CES"  wrote in message 
news:%23MhTrPMCJHA.1628@TK2MSFTNGP03.phx.gbl...
> Thanks for not answering my question...

I did answer your question. You did not give me a context to go from, so I 
made an incorrect assumption.

>I'm just switch over to .net from classic asp and as much as possible I'm 
>trying to take small steps with concepts I've used in the past and what you 
>just stated doesn't mean anything to me... yet!

Now I have a context.

ASP is inline coded. It is interpreted one line at a time. ASP.NET is 
compiled. This is your first paradigm shift.

You can do

<%
//code here
%>

in ASP.NET, but it is not advised. You are better to bind than to write out 
stuff.

For example, you want a copyright date. Here is your old code:

<div id="copyright">
Copyright  <%=DateTime.Now.Year.ToString()%> - <%=MyWebSite%> - All rights
reserved.
<br />Use of this site signifies the users complete agreement to all terms,
contained
<br />& described within the Terms of Use page (Updated July 31, 2008)
</div>

To do this in .NET, you have three choices:

1. Use a class derived from page
2. Use a master page
3. User a control

The master page is probably the best option, if this is all you are doing, 
but it is not something you can do to a page without altering it quite a 
bit. With the class option, you can pull your ASP tags and with minor 
alteration have the page running (it may not do everything the ASP does, but 
it will display the copyright).

The user control encapsulates the logic, but you will have to drag it on 
every page, which is why the master is so important.

Which of the options you ultimately chose depends on where you want to go. 
The best replacement for .inc is a derived class. The best option, long 
term, is a master page. If you feel you might use this in multiple sites, a 
user control (or even a compiled server control) may be a better option.

-- 
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box!                               |
********************************************
date: Tue, 2 Sep 2008 10:17:37 -0500   author:   Cowboy \(Gregory A. Beamer\) oSpamM

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us