Monday, March 26, 2012
newbie: Master pages... dynamic content...
I'm porting a windows app to the web - My main page is very simple and
will look something like this:
----
| Title |
----
| | button navigation bar |
| | ---|
| | |
| Menu| |
| | Content |
| | |
| | |
| | |
---
Menu is a treeview control that is (potientially) different for each
user that visits the site. (nodes are dynamically populated in the
treeview via code behind based on user's role and auth. level)
The Content can be any object renderable by a browser (HTM, flash, pdf,
office document, etc).
The question is can i display different web forms in the content part
when the menu is clicked?
I've looked at master pages but from what I understand they would only
be able to display HTM in the "Content" area. Does anyone have any
ideas on how to allow the content area to display other types of
objects?
Can anyone help a web rookie ?You have some incorrect notions.
Master pages can have dynamic content. The isue is they are a little harder
to ahve the page update master page content, but it is not impossible. And,
if you have the master page render dynamically, there is no issue. I see no
reason why a user driven menu cannot be placed in a master page.
If you use master pages, the different content is fairly easy. If not, you
will need another option. DotNet Nuke is an option and would be easier than
rolling your own.
Third choice, way out in left field, is to create your own engine to render
the pages. I would inherit from page to do this, as you can have your class
handle most of the lifting. User controls are also an option for content, if
you wish to use a model-view-controller type of set up. I would shy away
from any of these choices, esp. as a rookie, unless the master pages and
DotNet Nuke fail to work.
NOTE: Check out the starter kits under downloads at www.asp.net. They will
give you a good framework to start from.
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
****************************************
****
Think outside the box!
****************************************
****
"celoftis" <celoftis@.gmail.com> wrote in message
news:1168276140.365434.16250@.42g2000cwt.googlegroups.com...
> Using VS2005, VB codebehind,
> I'm porting a windows app to the web - My main page is very simple and
> will look something like this:
> ----
> | Title |
> ----
> | | button navigation bar |
> | | ---|
> | | |
> | Menu| |
> | | Content |
> | | |
> | | |
> | | |
> ---
> Menu is a treeview control that is (potientially) different for each
> user that visits the site. (nodes are dynamically populated in the
> treeview via code behind based on user's role and auth. level)
> The Content can be any object renderable by a browser (HTM, flash, pdf,
> office document, etc).
> The question is can i display different web forms in the content part
> when the menu is clicked?
> I've looked at master pages but from what I understand they would only
> be able to display HTM in the "Content" area. Does anyone have any
> ideas on how to allow the content area to display other types of
> objects?
> Can anyone help a web rookie ?
>
I have a treeview in a master page, and I display pdf files(EKGs and X-Rays)
in the content pages using an <embed> tag. The 'src' attribute of the embed
tag is assigned when the content page loads based on the query string used
to open the content page when a treeview node is clicked.
"celoftis" <celoftis@.gmail.com> wrote in message
news:1168276140.365434.16250@.42g2000cwt.googlegroups.com...
> Using VS2005, VB codebehind,
> I'm porting a windows app to the web - My main page is very simple and
> will look something like this:
> ----
> | Title |
> ----
> | | button navigation bar |
> | | ---|
> | | |
> | Menu| |
> | | Content |
> | | |
> | | |
> | | |
> ---
> Menu is a treeview control that is (potientially) different for each
> user that visits the site. (nodes are dynamically populated in the
> treeview via code behind based on user's role and auth. level)
> The Content can be any object renderable by a browser (HTM, flash, pdf,
> office document, etc).
> The question is can i display different web forms in the content part
> when the menu is clicked?
> I've looked at master pages but from what I understand they would only
> be able to display HTM in the "Content" area. Does anyone have any
> ideas on how to allow the content area to display other types of
> objects?
> Can anyone help a web rookie ?
>
Gregory,
Thanks for the reply. I'm excited at the possibility of making this
work.
I've got hundreds (if not a thousand) content pages that I need to be
target for the "child page". Problem is I don't want to modify all
the pages - in fact, the majority of the pages are on remote servers
that I have no access to - so I really just need to be able to point
to a URL and have it load in the child page. Can I still use master
pages to make this work?
I've reviewed ASP.NET downloads haven't found anything that suits my
situation - any other pointer or code snippets would be greatly
appreciated! Please Let me know what you think either way.
celoftis
Thanks... I'll keep that in mind.
The content inside a 'child page' needs to be inside a ContentPlaceHolderID
control. Also - the page needs to have the .aspx extension and have a
reference at the top of that content page, to the master page.
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com
"celoftis" <celoftis@.gmail.com> wrote in message
news:1168447380.383686.248680@.i56g2000hsf.googlegroups.com...
> Gregory,
> Thanks for the reply. I'm excited at the possibility of making this
> work.
> I've got hundreds (if not a thousand) content pages that I need to be
> target for the "child page". Problem is I don't want to modify all
> the pages - in fact, the majority of the pages are on remote servers
> that I have no access to - so I really just need to be able to point
> to a URL and have it load in the child page. Can I still use master
> pages to make this work?
> I've reviewed ASP.NET downloads haven't found anything that suits my
> situation - any other pointer or code snippets would be greatly
> appreciated! Please Let me know what you think either way.
> celoftis
>
David,
Thanks for the reply...
So, for my specifc situation (not being able to access all the content
pages), it looks like master pages are not going to work - do you
agree?
But if I could modify the content of all the child pages, then I could
use a script to wrap the existing page(s) with
ContentPlaceHolderID(s)... seems real messy.
newbie: Master pages... dynamic content...
I'm porting a windows app to the web - My main page is very simple and
will look something like this:
----------------
| Title |
----------------
| | button navigation bar |
| | ------------|
| | |
| Menu| |
| | Content |
| | |
| | |
| | |
---------------
Menu is a treeview control that is (potientially) different for each
user that visits the site. (nodes are dynamically populated in the
treeview via code behind based on user's role and auth. level)
The Content can be any object renderable by a browser (HTM, flash, pdf,
office document, etc).
The question is can i display different web forms in the content part
when the menu is clicked?
I've looked at master pages but from what I understand they would only
be able to display HTM in the "Content" area. Does anyone have any
ideas on how to allow the content area to display other types of
objects?
Can anyone help a web rookie ?You have some incorrect notions.
Master pages can have dynamic content. The isue is they are a little harder
to ahve the page update master page content, but it is not impossible. And,
if you have the master page render dynamically, there is no issue. I see no
reason why a user driven menu cannot be placed in a master page.
If you use master pages, the different content is fairly easy. If not, you
will need another option. DotNet Nuke is an option and would be easier than
rolling your own.
Third choice, way out in left field, is to create your own engine to render
the pages. I would inherit from page to do this, as you can have your class
handle most of the lifting. User controls are also an option for content, if
you wish to use a model-view-controller type of set up. I would shy away
from any of these choices, esp. as a rookie, unless the master pages and
DotNet Nuke fail to work.
NOTE: Check out the starter kits under downloads at www.asp.net. They will
give you a good framework to start from.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
********************************************
Think outside the box!
********************************************
"celoftis" <celoftis@.gmail.comwrote in message
news:1168276140.365434.16250@.42g2000cwt.googlegrou ps.com...
Quote:
Originally Posted by
Using VS2005, VB codebehind,
I'm porting a windows app to the web - My main page is very simple and
will look something like this:
----------------
| Title |
----------------
| | button navigation bar |
| | ------------|
| | |
| Menu| |
| | Content |
| | |
| | |
| | |
---------------
>
Menu is a treeview control that is (potientially) different for each
user that visits the site. (nodes are dynamically populated in the
treeview via code behind based on user's role and auth. level)
>
The Content can be any object renderable by a browser (HTM, flash, pdf,
office document, etc).
>
The question is can i display different web forms in the content part
when the menu is clicked?
>
I've looked at master pages but from what I understand they would only
be able to display HTM in the "Content" area. Does anyone have any
ideas on how to allow the content area to display other types of
objects?
Can anyone help a web rookie ?
>
I have a treeview in a master page, and I display pdf files(EKGs and X-Rays)
in the content pages using an <embedtag. The 'src' attribute of the embed
tag is assigned when the content page loads based on the query string used
to open the content page when a treeview node is clicked.
"celoftis" <celoftis@.gmail.comwrote in message
news:1168276140.365434.16250@.42g2000cwt.googlegrou ps.com...
Quote:
Originally Posted by
Using VS2005, VB codebehind,
I'm porting a windows app to the web - My main page is very simple and
will look something like this:
----------------
| Title |
----------------
| | button navigation bar |
| | ------------|
| | |
| Menu| |
| | Content |
| | |
| | |
| | |
---------------
>
Menu is a treeview control that is (potientially) different for each
user that visits the site. (nodes are dynamically populated in the
treeview via code behind based on user's role and auth. level)
>
The Content can be any object renderable by a browser (HTM, flash, pdf,
office document, etc).
>
The question is can i display different web forms in the content part
when the menu is clicked?
>
I've looked at master pages but from what I understand they would only
be able to display HTM in the "Content" area. Does anyone have any
ideas on how to allow the content area to display other types of
objects?
Can anyone help a web rookie ?
>
Gregory,
Thanks for the reply. I'm excited at the possibility of making this
work.
I've got hundreds (if not a thousand) content pages that I need to be
target for the "child page". Problem is I don't want to modify all
the pages - in fact, the majority of the pages are on remote servers
that I have no access to - so I really just need to be able to point
to a URL and have it load in the child page. Can I still use master
pages to make this work?
I've reviewed ASP.NET downloads haven't found anything that suits my
situation - any other pointer or code snippets would be greatly
appreciated! Please Let me know what you think either way.
celoftis
Thanks... I'll keep that in mind.
The content inside a 'child page' needs to be inside a ContentPlaceHolderID
control. Also - the page needs to have the .aspx extension and have a
reference at the top of that content page, to the master page.
--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com
"celoftis" <celoftis@.gmail.comwrote in message
news:1168447380.383686.248680@.i56g2000hsf.googlegr oups.com...
Quote:
Originally Posted by
Gregory,
Thanks for the reply. I'm excited at the possibility of making this
work.
I've got hundreds (if not a thousand) content pages that I need to be
target for the "child page". Problem is I don't want to modify all
the pages - in fact, the majority of the pages are on remote servers
that I have no access to - so I really just need to be able to point
to a URL and have it load in the child page. Can I still use master
pages to make this work?
>
I've reviewed ASP.NET downloads haven't found anything that suits my
situation - any other pointer or code snippets would be greatly
appreciated! Please Let me know what you think either way.
>
celoftis
>
David,
Thanks for the reply...
So, for my specifc situation (not being able to access all the content
pages), it looks like master pages are not going to work - do you
agree?
But if I could modify the content of all the child pages, then I could
use a script to wrap the existing page(s) with
ContentPlaceHolderID(s)... seems real messy.
Newbie: Multiple codebehind files
I'm not certain this can be done but it sure seems like it. I'd like to use
multiple C# codebehind files in an aspx page. The idea is that a number of
common functions, like wiring data sources, could be done in a similar
fashion for various controls across multiple pages. What makes sense to me
then would be to have an aspx page that uses a codebehind file. That file
would reference classes in a second file that did the common work.
Assuming I'm on the right track, how would you do this? Is it enough to
simply have both .cs files in the same folder or should each be referenced
in the @dotnet.itags.org.Page's Inherits and Src attributes? Basically, I think the idea
should work, but I'm missing the details on referencing and location.
For example, a control:
<asp:DropDownList id="ddlWidgets" runat="server" /
would be referenced in the codebehind's Page_Load method:
protected void Page_Load( Object Source, EventArgs Args )
{
if (!IsPostBack)
{
WireUpControl( ddlWidgets, "Widgets" );
}
}
where WireUpControl is a method in a class located in a different file that
takes a reference to the control and a table name and binds that table's
data to the control.
TIA,
JohnYou don't need multiple code behinds, just multiple class files if you
will... In which case you can add event handlers etc...
you could have nothing but your event handlers in your code behind that make
reference to other classes.. or, if you have a page that your going to use a
lot of functions a lot... inherit it from system.web.ui.page, creating
your own class with those functions you want.
Then inherit that page into all your otherpages... boom...
This is really effective if you have say a search bar on every page... Just
for example.
-CJ
"John Spiegel" <jspiegel@.c-comld.com> wrote in message
news:unKWETKbDHA.384@.TK2MSFTNGP12.phx.gbl...
> Hi All,
> I'm not certain this can be done but it sure seems like it. I'd like to
use
> multiple C# codebehind files in an aspx page. The idea is that a number
of
> common functions, like wiring data sources, could be done in a similar
> fashion for various controls across multiple pages. What makes sense to
me
> then would be to have an aspx page that uses a codebehind file. That file
> would reference classes in a second file that did the common work.
> Assuming I'm on the right track, how would you do this? Is it enough to
> simply have both .cs files in the same folder or should each be referenced
> in the @.Page's Inherits and Src attributes? Basically, I think the idea
> should work, but I'm missing the details on referencing and location.
> For example, a control:
> <asp:DropDownList id="ddlWidgets" runat="server" />
> would be referenced in the codebehind's Page_Load method:
> protected void Page_Load( Object Source, EventArgs Args )
> {
> if (!IsPostBack)
> {
> WireUpControl( ddlWidgets, "Widgets" );
> }
> }
> where WireUpControl is a method in a class located in a different file
that
> takes a reference to the control and a table name and binds that table's
> data to the control.
> TIA,
> John
Hi John,
Speaking from a C# background, and in an OO sense certainly, you should not
be able to inherit from more than one superclass (unless you are using C or
something). So it makes sense to assume you cannot inherit from more than
one 'codebehind'.
The usual practice is to place commonly used functions in a different
abstract superclass, further up the heirarchy. However, don't lean too
heavily on heirarchies, as they can become difficult to maintain in an
extensibility sense. Consider instead using the strategy pattern as an
alternative?
hth,
Ben
"John Spiegel" <jspiegel@.c-comld.com> wrote in message
news:unKWETKbDHA.384@.TK2MSFTNGP12.phx.gbl...
> Hi All,
> I'm not certain this can be done but it sure seems like it. I'd like to
use
> multiple C# codebehind files in an aspx page. The idea is that a number
of
> common functions, like wiring data sources, could be done in a similar
> fashion for various controls across multiple pages. What makes sense to
me
> then would be to have an aspx page that uses a codebehind file. That file
> would reference classes in a second file that did the common work.
> Assuming I'm on the right track, how would you do this? Is it enough to
> simply have both .cs files in the same folder or should each be referenced
> in the @.Page's Inherits and Src attributes? Basically, I think the idea
> should work, but I'm missing the details on referencing and location.
> For example, a control:
> <asp:DropDownList id="ddlWidgets" runat="server" />
> would be referenced in the codebehind's Page_Load method:
> protected void Page_Load( Object Source, EventArgs Args )
> {
> if (!IsPostBack)
> {
> WireUpControl( ddlWidgets, "Widgets" );
> }
> }
> where WireUpControl is a method in a class located in a different file
that
> takes a reference to the control and a table name and binds that table's
> data to the control.
> TIA,
> John
"John Spiegel" <jspiegel@.c-comld.com> wrote in message
news:unKWETKbDHA.384@.TK2MSFTNGP12.phx.gbl...
> Hi All,
> I'm not certain this can be done but it sure seems like it. I'd like to
use
> multiple C# codebehind files in an aspx page. The idea is that a number
of
> common functions, like wiring data sources, could be done in a similar
> fashion for various controls across multiple pages. What makes sense to
me
> then would be to have an aspx page that uses a codebehind file. That file
> would reference classes in a second file that did the common work.
John,
There are "CodeBehind" files, which are the .aspx.cs files. These are the
"other side" of the .aspx files.
Your web project can contain classes which are not related to a single page.
You can always add these separate classes in .cs files and then reference
them from your codebehind (.aspx.cs) files.
--
John Saunders
Internet Engineer
john.saunders@.surfcontrol.com
Thanks guys. Just the kind of stuff I'm needing.
Desperately looking forward to the day when I can honestly drop the
"Newbie:" tag on my subjects... <g
- John
"John Spiegel" <jspiegel@.c-comld.com> wrote in message
news:unKWETKbDHA.384@.TK2MSFTNGP12.phx.gbl...
> Hi All,
> I'm not certain this can be done but it sure seems like it. I'd like to
use
> multiple C# codebehind files in an aspx page. The idea is that a number
of
> common functions, like wiring data sources, could be done in a similar
> fashion for various controls across multiple pages. What makes sense to
me
> then would be to have an aspx page that uses a codebehind file. That file
> would reference classes in a second file that did the common work.
> Assuming I'm on the right track, how would you do this? Is it enough to
> simply have both .cs files in the same folder or should each be referenced
> in the @.Page's Inherits and Src attributes? Basically, I think the idea
> should work, but I'm missing the details on referencing and location.
> For example, a control:
> <asp:DropDownList id="ddlWidgets" runat="server" />
> would be referenced in the codebehind's Page_Load method:
> protected void Page_Load( Object Source, EventArgs Args )
> {
> if (!IsPostBack)
> {
> WireUpControl( ddlWidgets, "Widgets" );
> }
> }
> where WireUpControl is a method in a class located in a different file
that
> takes a reference to the control and a table name and binds that table's
> data to the control.
> TIA,
> John