469,282 Members | 1,869 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

cfinclude functionality in ASP.NET

Trying to achieve this functionality in ASP.NET.
<cfif NOT session.loggedin>
<cfinclude template="loginPage.cfm">
<cfelse>
<cfif session.loginType EQ "Instructor">
... show Instructor menu...
<cfif form.menuItem EQ 1>
<cfinclude template="MenuItem1Page.cfm">
<cfelseif form.menuItem EQ 2>
.......
</cfif>
<cfelseif session.loginType EQ "Reviewer">
... show Reviewer menu ...
... includes for Reviewers
</cfif>
</cfif>
Trying nested master pages but having trouble implementing the nesting
(Whidbey beta 1). Also not sure how to navigate between NOT logged in and
logged in and among menuItem pages. Thanks in advance.
Nov 19 '05 #1
7 2136
I'm not familiar with Cold Fusion, but I know it is similar to ASP. So,
forgive me if I interpret you incorrectly, but it sure looks like your
"cfinclude" tag is, in essence, a dynamic include file. If so, as ASP.Net is
object-oriented, you would want to create a class instead, either a User
Control (if you want to use a template) or a Server Control (which is a pure
class), and conditionally create an instance of it and place it in your
page.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
Trying to achieve this functionality in ASP.NET.
<cfif NOT session.loggedin>
<cfinclude template="loginPage.cfm">
<cfelse>
<cfif session.loginType EQ "Instructor">
... show Instructor menu...
<cfif form.menuItem EQ 1>
<cfinclude template="MenuItem1Page.cfm">
<cfelseif form.menuItem EQ 2>
.......
</cfif>
<cfelseif session.loginType EQ "Reviewer">
... show Reviewer menu ...
... includes for Reviewers
</cfif>
</cfif>
Trying nested master pages but having trouble implementing the nesting
(Whidbey beta 1). Also not sure how to navigate between NOT logged in and
logged in and among menuItem pages. Thanks in advance.

Nov 19 '05 #2
Thanks, Kevn. You inferred correctly re Cold Fusion. I think a structure
like this would work - pseudocode:
Main.master (<html><links><meta> etc.)
if not logged in then
LoginRoutine.aspx
elseif login successful then
if user is Instructor then
Instructor.master (containing menu options)
InstructorFunction_1.aspx
......
InstructorFunction_N.aspx
elseif user is Reviewer then
Reviewer.master (containing reviewer menu options)
ReviewerFuntion_1.aspx
....
ReviewerFuntion_N.aspx
endif
endif

I think I've figured out the basic plumbing of nested masters since my
original post.
But still not sure of best way to transfer from page to page. Have been
doing the following which seems to work but it's unappealing:

httpContext.Current.Response.Redirect(xxx.aspx) in a content page's
Load_Page method.

Is there a better way?

"Kevin Spencer" wrote:
I'm not familiar with Cold Fusion, but I know it is similar to ASP. So,
forgive me if I interpret you incorrectly, but it sure looks like your
"cfinclude" tag is, in essence, a dynamic include file. If so, as ASP.Net is
object-oriented, you would want to create a class instead, either a User
Control (if you want to use a template) or a Server Control (which is a pure
class), and conditionally create an instance of it and place it in your
page.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
Trying to achieve this functionality in ASP.NET.
<cfif NOT session.loggedin>
<cfinclude template="loginPage.cfm">
<cfelse>
<cfif session.loginType EQ "Instructor">
... show Instructor menu...
<cfif form.menuItem EQ 1>
<cfinclude template="MenuItem1Page.cfm">
<cfelseif form.menuItem EQ 2>
.......
</cfif>
<cfelseif session.loginType EQ "Reviewer">
... show Reviewer menu ...
... includes for Reviewers
</cfif>
</cfif>
Trying nested master pages but having trouble implementing the nesting
(Whidbey beta 1). Also not sure how to navigate between NOT logged in and
logged in and among menuItem pages. Thanks in advance.


Nov 19 '05 #3
I really don't think you want nested pages. What you want is a User Control
(which is almost like a Page, but is designed to be used IN a page), or a
Server Control. Or you may want to do a Response.Redirect or a
Server.Transfer to a differrent page.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
Thanks, Kevn. You inferred correctly re Cold Fusion. I think a structure
like this would work - pseudocode:
Main.master (<html><links><meta> etc.)
if not logged in then
LoginRoutine.aspx
elseif login successful then
if user is Instructor then
Instructor.master (containing menu options)
InstructorFunction_1.aspx
......
InstructorFunction_N.aspx
elseif user is Reviewer then
Reviewer.master (containing reviewer menu options)
ReviewerFuntion_1.aspx
....
ReviewerFuntion_N.aspx
endif
endif

I think I've figured out the basic plumbing of nested masters since my
original post.
But still not sure of best way to transfer from page to page. Have been
doing the following which seems to work but it's unappealing:

httpContext.Current.Response.Redirect(xxx.aspx) in a content page's
Load_Page method.

Is there a better way?

"Kevin Spencer" wrote:
I'm not familiar with Cold Fusion, but I know it is similar to ASP. So,
forgive me if I interpret you incorrectly, but it sure looks like your
"cfinclude" tag is, in essence, a dynamic include file. If so, as ASP.Net
is
object-oriented, you would want to create a class instead, either a User
Control (if you want to use a template) or a Server Control (which is a
pure
class), and conditionally create an instance of it and place it in your
page.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
> Trying to achieve this functionality in ASP.NET.
> <cfif NOT session.loggedin>
> <cfinclude template="loginPage.cfm">
> <cfelse>
> <cfif session.loginType EQ "Instructor">
> ... show Instructor menu...
> <cfif form.menuItem EQ 1>
> <cfinclude template="MenuItem1Page.cfm">
> <cfelseif form.menuItem EQ 2>
> .......
> </cfif>
> <cfelseif session.loginType EQ "Reviewer">
> ... show Reviewer menu ...
> ... includes for Reviewers
> </cfif>
> </cfif>
> Trying nested master pages but having trouble implementing the nesting
> (Whidbey beta 1). Also not sure how to navigate between NOT logged in
> and
> logged in and among menuItem pages. Thanks in advance.


Nov 19 '05 #4
Thanks, Kevin.
I guess you mean something like this schematically:
InstructorFunctions.aspx with these:
User control ID = menu
User control ID = InstructorFunction_1 (Invoked conditionally)
User control ID = InstructorFunction_2 (Invoked conditionally)
....
User control ID = InstructorFunction_1 (Invoked conditionally)

I'll try this.

"Kevin Spencer" wrote:
I really don't think you want nested pages. What you want is a User Control
(which is almost like a Page, but is designed to be used IN a page), or a
Server Control. Or you may want to do a Response.Redirect or a
Server.Transfer to a differrent page.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
Thanks, Kevn. You inferred correctly re Cold Fusion. I think a structure
like this would work - pseudocode:
Main.master (<html><links><meta> etc.)
if not logged in then
LoginRoutine.aspx
elseif login successful then
if user is Instructor then
Instructor.master (containing menu options)
InstructorFunction_1.aspx
......
InstructorFunction_N.aspx
elseif user is Reviewer then
Reviewer.master (containing reviewer menu options)
ReviewerFuntion_1.aspx
....
ReviewerFuntion_N.aspx
endif
endif

I think I've figured out the basic plumbing of nested masters since my
original post.
But still not sure of best way to transfer from page to page. Have been
doing the following which seems to work but it's unappealing:

httpContext.Current.Response.Redirect(xxx.aspx) in a content page's
Load_Page method.

Is there a better way?

"Kevin Spencer" wrote:
I'm not familiar with Cold Fusion, but I know it is similar to ASP. So,
forgive me if I interpret you incorrectly, but it sure looks like your
"cfinclude" tag is, in essence, a dynamic include file. If so, as ASP.Net
is
object-oriented, you would want to create a class instead, either a User
Control (if you want to use a template) or a Server Control (which is a
pure
class), and conditionally create an instance of it and place it in your
page.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
> Trying to achieve this functionality in ASP.NET.
> <cfif NOT session.loggedin>
> <cfinclude template="loginPage.cfm">
> <cfelse>
> <cfif session.loginType EQ "Instructor">
> ... show Instructor menu...
> <cfif form.menuItem EQ 1>
> <cfinclude template="MenuItem1Page.cfm">
> <cfelseif form.menuItem EQ 2>
> .......
> </cfif>
> <cfelseif session.loginType EQ "Reviewer">
> ... show Reviewer menu ...
> ... includes for Reviewers
> </cfif>
> </cfif>
> Trying nested master pages but having trouble implementing the nesting
> (Whidbey beta 1). Also not sure how to navigate between NOT logged in
> and
> logged in and among menuItem pages. Thanks in advance.


Nov 19 '05 #5
Hi Peter,

That looks about right to me! :)

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.com...
Thanks, Kevin.
I guess you mean something like this schematically:
InstructorFunctions.aspx with these:
User control ID = menu
User control ID = InstructorFunction_1 (Invoked conditionally)
User control ID = InstructorFunction_2 (Invoked conditionally)
....
User control ID = InstructorFunction_1 (Invoked conditionally)

I'll try this.

"Kevin Spencer" wrote:
I really don't think you want nested pages. What you want is a User
Control
(which is almost like a Page, but is designed to be used IN a page), or a
Server Control. Or you may want to do a Response.Redirect or a
Server.Transfer to a differrent page.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
> Thanks, Kevn. You inferred correctly re Cold Fusion. I think a
> structure
> like this would work - pseudocode:
> Main.master (<html><links><meta> etc.)
> if not logged in then
> LoginRoutine.aspx
> elseif login successful then
> if user is Instructor then
> Instructor.master (containing menu options)
> InstructorFunction_1.aspx
> ......
> InstructorFunction_N.aspx
> elseif user is Reviewer then
> Reviewer.master (containing reviewer menu options)
> ReviewerFuntion_1.aspx
> ....
> ReviewerFuntion_N.aspx
> endif
> endif
>
> I think I've figured out the basic plumbing of nested masters since my
> original post.
> But still not sure of best way to transfer from page to page. Have
> been
> doing the following which seems to work but it's unappealing:
>
> httpContext.Current.Response.Redirect(xxx.aspx) in a content page's
> Load_Page method.
>
> Is there a better way?
>
> "Kevin Spencer" wrote:
>
>> I'm not familiar with Cold Fusion, but I know it is similar to ASP.
>> So,
>> forgive me if I interpret you incorrectly, but it sure looks like your
>> "cfinclude" tag is, in essence, a dynamic include file. If so, as
>> ASP.Net
>> is
>> object-oriented, you would want to create a class instead, either a
>> User
>> Control (if you want to use a template) or a Server Control (which is
>> a
>> pure
>> class), and conditionally create an instance of it and place it in
>> your
>> page.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> ..Net Developer
>> Ambiguity has a certain quality to it.
>>
>> "Peter" <Pe***@discussions.microsoft.com> wrote in message
>> news:89**********************************@microsof t.com...
>> > Trying to achieve this functionality in ASP.NET.
>> > <cfif NOT session.loggedin>
>> > <cfinclude template="loginPage.cfm">
>> > <cfelse>
>> > <cfif session.loginType EQ "Instructor">
>> > ... show Instructor menu...
>> > <cfif form.menuItem EQ 1>
>> > <cfinclude template="MenuItem1Page.cfm">
>> > <cfelseif form.menuItem EQ 2>
>> > .......
>> > </cfif>
>> > <cfelseif session.loginType EQ "Reviewer">
>> > ... show Reviewer menu ...
>> > ... includes for Reviewers
>> > </cfif>
>> > </cfif>
>> > Trying nested master pages but having trouble implementing the
>> > nesting
>> > (Whidbey beta 1). Also not sure how to navigate between NOT logged
>> > in
>> > and
>> > logged in and among menuItem pages. Thanks in advance.
>>
>>
>>


Nov 19 '05 #6
Hi Peter,

Also, if you're using User Controls, be aware that they CAN be conditionally
loaded (that is, not be in the Page Template, but loaded into the Page at
run-time). This is done by using the Page.LoadControl() method.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.com...
Thanks, Kevin.
I guess you mean something like this schematically:
InstructorFunctions.aspx with these:
User control ID = menu
User control ID = InstructorFunction_1 (Invoked conditionally)
User control ID = InstructorFunction_2 (Invoked conditionally)
....
User control ID = InstructorFunction_1 (Invoked conditionally)

I'll try this.

"Kevin Spencer" wrote:
I really don't think you want nested pages. What you want is a User
Control
(which is almost like a Page, but is designed to be used IN a page), or a
Server Control. Or you may want to do a Response.Redirect or a
Server.Transfer to a differrent page.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
> Thanks, Kevn. You inferred correctly re Cold Fusion. I think a
> structure
> like this would work - pseudocode:
> Main.master (<html><links><meta> etc.)
> if not logged in then
> LoginRoutine.aspx
> elseif login successful then
> if user is Instructor then
> Instructor.master (containing menu options)
> InstructorFunction_1.aspx
> ......
> InstructorFunction_N.aspx
> elseif user is Reviewer then
> Reviewer.master (containing reviewer menu options)
> ReviewerFuntion_1.aspx
> ....
> ReviewerFuntion_N.aspx
> endif
> endif
>
> I think I've figured out the basic plumbing of nested masters since my
> original post.
> But still not sure of best way to transfer from page to page. Have
> been
> doing the following which seems to work but it's unappealing:
>
> httpContext.Current.Response.Redirect(xxx.aspx) in a content page's
> Load_Page method.
>
> Is there a better way?
>
> "Kevin Spencer" wrote:
>
>> I'm not familiar with Cold Fusion, but I know it is similar to ASP.
>> So,
>> forgive me if I interpret you incorrectly, but it sure looks like your
>> "cfinclude" tag is, in essence, a dynamic include file. If so, as
>> ASP.Net
>> is
>> object-oriented, you would want to create a class instead, either a
>> User
>> Control (if you want to use a template) or a Server Control (which is
>> a
>> pure
>> class), and conditionally create an instance of it and place it in
>> your
>> page.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> ..Net Developer
>> Ambiguity has a certain quality to it.
>>
>> "Peter" <Pe***@discussions.microsoft.com> wrote in message
>> news:89**********************************@microsof t.com...
>> > Trying to achieve this functionality in ASP.NET.
>> > <cfif NOT session.loggedin>
>> > <cfinclude template="loginPage.cfm">
>> > <cfelse>
>> > <cfif session.loginType EQ "Instructor">
>> > ... show Instructor menu...
>> > <cfif form.menuItem EQ 1>
>> > <cfinclude template="MenuItem1Page.cfm">
>> > <cfelseif form.menuItem EQ 2>
>> > .......
>> > </cfif>
>> > <cfelseif session.loginType EQ "Reviewer">
>> > ... show Reviewer menu ...
>> > ... includes for Reviewers
>> > </cfif>
>> > </cfif>
>> > Trying nested master pages but having trouble implementing the
>> > nesting
>> > (Whidbey beta 1). Also not sure how to navigate between NOT logged
>> > in
>> > and
>> > logged in and among menuItem pages. Thanks in advance.
>>
>>
>>


Nov 19 '05 #7
Got it! Have the menu working now as user control. With ViewState enabled,
using
Page_Load()
{
if(!IsPostBack)
{
... add menu items here ...
}
}

Love the tip on Page.LoadControl().

Thanks,

Peter

"Kevin Spencer" wrote:
Hi Peter,

Also, if you're using User Controls, be aware that they CAN be conditionally
loaded (that is, not be in the Page Template, but loaded into the Page at
run-time). This is done by using the Page.LoadControl() method.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.com...
Thanks, Kevin.
I guess you mean something like this schematically:
InstructorFunctions.aspx with these:
User control ID = menu
User control ID = InstructorFunction_1 (Invoked conditionally)
User control ID = InstructorFunction_2 (Invoked conditionally)
....
User control ID = InstructorFunction_1 (Invoked conditionally)

I'll try this.

"Kevin Spencer" wrote:
I really don't think you want nested pages. What you want is a User
Control
(which is almost like a Page, but is designed to be used IN a page), or a
Server Control. Or you may want to do a Response.Redirect or a
Server.Transfer to a differrent page.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
> Thanks, Kevn. You inferred correctly re Cold Fusion. I think a
> structure
> like this would work - pseudocode:
> Main.master (<html><links><meta> etc.)
> if not logged in then
> LoginRoutine.aspx
> elseif login successful then
> if user is Instructor then
> Instructor.master (containing menu options)
> InstructorFunction_1.aspx
> ......
> InstructorFunction_N.aspx
> elseif user is Reviewer then
> Reviewer.master (containing reviewer menu options)
> ReviewerFuntion_1.aspx
> ....
> ReviewerFuntion_N.aspx
> endif
> endif
>
> I think I've figured out the basic plumbing of nested masters since my
> original post.
> But still not sure of best way to transfer from page to page. Have
> been
> doing the following which seems to work but it's unappealing:
>
> httpContext.Current.Response.Redirect(xxx.aspx) in a content page's
> Load_Page method.
>
> Is there a better way?
>
> "Kevin Spencer" wrote:
>
>> I'm not familiar with Cold Fusion, but I know it is similar to ASP.
>> So,
>> forgive me if I interpret you incorrectly, but it sure looks like your
>> "cfinclude" tag is, in essence, a dynamic include file. If so, as
>> ASP.Net
>> is
>> object-oriented, you would want to create a class instead, either a
>> User
>> Control (if you want to use a template) or a Server Control (which is
>> a
>> pure
>> class), and conditionally create an instance of it and place it in
>> your
>> page.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> ..Net Developer
>> Ambiguity has a certain quality to it.
>>
>> "Peter" <Pe***@discussions.microsoft.com> wrote in message
>> news:89**********************************@microsof t.com...
>> > Trying to achieve this functionality in ASP.NET.
>> > <cfif NOT session.loggedin>
>> > <cfinclude template="loginPage.cfm">
>> > <cfelse>
>> > <cfif session.loginType EQ "Instructor">
>> > ... show Instructor menu...
>> > <cfif form.menuItem EQ 1>
>> > <cfinclude template="MenuItem1Page.cfm">
>> > <cfelseif form.menuItem EQ 2>
>> > .......
>> > </cfif>
>> > <cfelseif session.loginType EQ "Reviewer">
>> > ... show Reviewer menu ...
>> > ... includes for Reviewers
>> > </cfif>
>> > </cfif>
>> > Trying nested master pages but having trouble implementing the
>> > nesting
>> > (Whidbey beta 1). Also not sure how to navigate between NOT logged
>> > in
>> > and
>> > logged in and among menuItem pages. Thanks in advance.
>>
>>
>>


Nov 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Vikas | last post: by
25 posts views Thread by KK | last post: by
3 posts views Thread by YaoBao | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.