MVC :: Selectively Displaying Content In The Master View?

Jun 29, 2010

In any strongly-typed View, I can test for a value within the Model and display content within the View, or not, as I choose. I'm having fits trying to get this same thing to work within the Master View. Since the Master View doesn't have its own Controller, but rather uses the Controller of whatever View is being rendered at the time, it's not like I can assign an object for the Master View to inherit from as I can with a normal View. Or at least I don't know how. I've also tried setting ViewData within a base Controller class, but that hasn't worked out, and is the subject of another thread.

When any View loads, I want to be able to run a check for the current user's security group (not ASP.NET roles, but a special object for the current project). Based on their security group I'll either show certain menu items or not, and direct them to a default View for their group. I suppose that in the default Controller that rolls when the project starts, I can do a check and redirect to an action based on the security group, but that still doesn't tell me how to render out menu items based on

View 1 Replies


Similar Messages:

MVC :: Displaying View Content Based On Role?

Jul 28, 2010

I have developed an ASP.NET MVC 2 application on Framework 4. I have an 'Administration' link on the home page. My query is, what is the best approach of displaying the 'Administration' link only to the users in the role administrator and hiding it from others keeping in mind the Seperation of Concern bit.

View 2 Replies

Web Forms :: Master Page Layout Not Displaying On Content Page?

Mar 27, 2010

I am new to ASP.NET development and I am running into an issue using master/content pages. I have a master file that basically defines all of the layout for my site. The only thing that the content pages are supposed to display is some very basic text/images/html, made available by one ContentPlaceHolder control in the master file.

My problem is in the display. When I view the content page, none of the layout that should be inherited from the master page is displayed -- I end up with just a 'blank' page. What seems odd, is that if I look at the Design View in VS 2005, the content page appears to show the layout that is defined in the master. Here is a sample of the source for the master and one of the content pages...

Master Page: content_pages.master
<%@ Master Language="VB" CodeFile="content_pages.master.vb" Inherits="content_pages" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
... links to CSS & Javascript files here (removed for simpler display in this post) ...
</head>
<body>
<form id="form1" runat="server">
<div id="content_holder">
<div id="content_background_top"></div>
<div id="content_background_middle">
<div id="header">
<div id="menu">... Menu Item Code (removed for simpler display in this post) ...</div>
</div>
<div id="gray_fade_bar"></div>
<div id="site_page_main">
<asp:ContentPlaceHolder id="PageContent" runat="server"></asp:ContentPlaceHolder>
</div>
<div id="footer">Footer Text Here</div>
</div>
<div id="content_background_bottom"></div>
</div>
</form>
</body>
</html>

Content Page: locations_odessa.aspx

<%@ Page Language="VB" MasterPageFile="~/content_pages.master" AutoEventWireup="false" CodeFile="locations_odessa.aspx.vb" Inherits="locations_odessa" title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PageContent" Runat="Server">
Page content will display here.
</asp:Content>

View 3 Replies

Forms Data Controls :: Frozen Grid View Not Working In Master / Content Page?

Jun 25, 2010

I am trying to use Matt Dotson FrozenGrid View [http://blogs.msdn.com/b/mattdotson/archive/2006/03/02/542613.aspx] in Master/Content page but the header of the gridview doesn't get fixed. I tried putting gridview inside the panel and but no luck.

View 3 Replies

Forms Data Controls :: Get Check Box Value From Grid View Content Page/ Master Page?

Oct 22, 2010

how to get check box value from grid view content page/ master page

i am using following code to get the value of check box from grid view content page / master page but it not works properly

[code]....

View 4 Replies

MVC :: Include View Content Page In My Master Page

Feb 21, 2010

I want to include view content page in my master page: My MVC application Left Menu MainPage. The Left Menu and Main page are two contentHolders in the master page. How can I add the Left Menu (View content page) to my Master page?. The Left Menu page is going to be a permanent page. The Content in the main Page is going to change. Left Menu content needs to be the permanent content for all other pages.

I searched in the internet, but I didn't find any solution that solves my problem. Basically I need some permanent menu items in the left page. But, I should not write the code in my master page. I need to add that Menucontent as my contentPage to the master. I have tried that by adding a New content page called "LeftPage.aspx" in View/Home folder.I have referred this page to the master "Left content holder". As the ASP.Net MVC talk to the controller, the left menu is not getting displayed while page loading.If i specify the ControlAction for this left page and specify the URL as //Home/Left ;then the page is getting displayed with only the left page content.

View 4 Replies

C# - Master Page Which Wraps The Content Pages Content In The Form, Can't Nest The Forms?

Oct 5, 2010

The WorldPay payment gateway suggests using this HTML to take the customer to the payment page:

<form action="https://select-test.wp3.rbsworldpay.com/wcc/purchase" name="BuyForm" method="POST">
<input type="hidden" name="instId" value="211616">
<input type="hidden" name="cartId" value="abc123">
<input type="hidden" name="currency" value="GBP">
<input type="hidden" name="amount" value="0">
<input type="hidden" name="desc" value="">
<input type="hidden" name="testMode" value="100">
<input type="submit" value="To Payment!">
</form>

How to I put this form on my page? The problem is I have a master page which wraps the content pages content in the ASP.net form, I can't nest the forms.

View 2 Replies

How To Add Title And Meta Tags For Content Pages In A Project Base On Master And Content Page

Oct 17, 2010

how can i add title and meta tags for content pages in a project base on master and content page(dinamically) ?

i used the blow method for master page :

[code]....

and the error is :(in line *)

Error 17 'System.Web.UI.MasterPage' does not contain a definition for 'SetMetaTags' and no extension method 'SetMetaTags' accepting a first argument of type 'System.Web.UI.MasterPage' could be found (are you missing a using directive or an assembly reference?)

View 3 Replies

Master Pages - Content Web Form - Content From Placeholder Disappears

Apr 9, 2010

I'm attempting to set a class on the body tag in my asp.net site which uses a master page and content web forms. I simply want to be able to do this by adding a bodycssclass property (see below) to the content web form page directive.

It works through the solution below but when i attempt to view Default.aspx the Content1 control loses its content.

Here is how I'm doing it. I have a master page with the following content:

[code]....

View 2 Replies

MVC :: Load View And Partial View (Master / Detail) With Default Parameter?

Sep 8, 2010

Members view (index) that lists members that users can select to show a partial view in the same view with details for the selected memberUses jquery (Ajax.ActionLink) to call a partial view method in the members controller to then load the members detail sectionWorks fine up to here....but I'd like to load the partial view with "member" details for a default or random member on initial load -- ie not through the Actionlink selectionHow do I invoke the partial view method on the initial load?

View 4 Replies

Web Forms :: Content Controls Are Allowed Only In Content Page That References A Master Page.

Jun 25, 2010

which page need to be checked. Master or Content. I dont think there is anything wrong in the content page.

View 1 Replies

C# - Output Javascript Selectively Depending On Application Settings?

Feb 24, 2010

I am developing a site which includes several different javascript files and libraries. For optimization purposes I have implemented YUI Compressor for .Net

This will minimize and combine my javascript files into one single file.

Now I have put this up in a MSBuild script that automatically does the compression and minimization and outputs it to a file of my choosing. However, I still wish to keep the original javascript files in my development environment. My question is simply:

Is there a good way to depending on the Debug setting for example choose which javascript to use? This to not have to change the MasterPage by hand each time I release the build.

Allow me to illustrate.

If I am running in Debug="true" I wish my MasterPage to include the following javascripts:

<script type="text/javascript" src="first.js"></script>
<script type="text/javascript" src="second.js"></script>
<script type="text/javascript" src="third.js"></script>
<script type="text/javascript" src="fourth.js"></script>

If I am running in Debug="false" I wish this to be outputted in the MasterPage:

<script type="text/javascript" src="compressedAndMinimized.js"></script>

View 2 Replies

Web Forms :: Batch Creation Of Content Pages (re: Master / Content Pages)

Apr 19, 2010

I have over 300 content pages to create. Each has some standard styling. I would like to generate these pages, and was just wondering if there is a utility in web developer 2008 express to do so (otherwise I will just build one - but it would be great not having to do so!)

View 1 Replies

Content Controls Allowed Only In Content Page That References A Master Page

Mar 10, 2016

Can I ask what this error refers to, (I have had it twice now over the last couple of days and then it goes away):

System.Web.HttpException: Content controls are allowed only in content page that references a master page.

This is followed by Stack Trace:

[HttpException (0x80004005): Content controls are allowed only in content page that references a master page.]
System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +9744256
System.Web.UI.Page.get_Master() +55
System.Web.UI.Page.ApplyMasterPage() +14
System.Web.UI.Page.PerformPreInit() +51
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1104

I am not using any Content Place Holder or Master Page (does the error refer to the Site.Master file because while I can see it in. Solution Explorer, I never use it. All of my aspx files look like this along the top with no reference to Site.Master:

Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="register1.aspx.vb" Inherits="register1" %>

View 3 Replies

Web Forms :: Master Pages - How To Access Content Page From Master Page

Sep 5, 2010

I have a master page setup that is used throughout my site that is basically a header with a menu. I recently added a textbox and a button to this master page which is to be a quick search box that is available anywhere in the site. When a user enters text into the search box and hits the button, I need to load the actual content page which is used to search and show search results (which also uses this same master page), and have the text entered available so the search can be triggered automatically. Again, this search text box and button is now in my master page so it could be triggered from anywhere in the app... it serves as a convenient way to do a basic search from anywhere in my app, without having to first navigate to the actual 'search page' that already exists. You can also navigate to the actual search page, which uses the same master page, where there is many more search options.I'm thrown off by the master page arrangement, which I have not used until this project. What do I do?

View 4 Replies

Forms Data Controls :: Selectively Render HTML From GridView

Jan 20, 2010

I have 3 columns in a GridView. The first is a templatefield with a button in it and then other 2 are just plain data from the database. Currently when I try to render the HTML from the GridView I see all 3 columns, but I only want to see the plain data fields. I have seen the answer as:gvQuotes.Columns[0].Visible = alse;But that doesn't work for me, because I still want to keep the first templatefield column on my page.

View 1 Replies

Forms Data Controls :: Display An Icon In Gridview - Selectively?

Aug 24, 2010

I've created an ExpenseReport application which allows users to attach receipts to Expense Report Lineitems. These are contained in a gridview using a template field:

[Code]....

The trouble I have is that the 'attachment.jpg' icon shows for every lineitem (even one that does not contain an attachment). I would like to be able to selectively display this icon or show a different icon if there is NO attachment.

View 9 Replies

C# - Displaying RSS Or Atom Content In ListView?

Feb 6, 2011

I am using SyndicationFeed to pull the data down and parse it. I am able to accomplish this but not without quite a bit of code.

I feel like there should be a while of doing this in a few lines of code and bind that to the ListView.

Can anyone point me at a 'really simple' way to pull rss or atom feed off of another site and bind its contents into a ListView control on my page, including the content of each item?

View 2 Replies

Converting Content Pages To Nested Master Content Pages In .net

Jul 28, 2010

I have a main master page, say MasterPageMain, and a couple of folders with couple of pages in each folder which act as a child page to that master page - MasterPageMain.

Now, I have about 10 pages in one of the folder which follows a certain pattern and they could really use a nested pages since any change on some parts needs me to change all the pages which is a pain really.

I already added a Nested master page, say NestedMasterPage - which is a child of MasterPageMain

I tried to change one of the page's <%@ Page directive to NestedMasterPage, immediately, there were a lot of errors. plus I dint know where the NestedMasterPage's children content would go.

What do I need to know in order to do this succesfully?

ps: I dint do this initially because I only had 2 pages, and I dint need this at that time, as the project grew, now i see that I should have changed it much earlier..

View 2 Replies

Web Forms :: Accessing Master Page Content From Content Page?

Feb 16, 2010

I am having asp:hyperlinks in my master page, which i use as my page headers. I would just like to change the text format of the hyperlink when a content page is loaded.

the CS code for accessing the master page contents from content page?

View 3 Replies

Dropdown Is Not Displaying The Content In Internet Explorer?

Mar 26, 2010

Dropdown is not displaying the content in Internet Explorer if the content width is more than dropdown width but in mozilla it displaying the content properly how to solve this issue

View 3 Replies

Web Forms :: Page Not Displaying Content Correctly?

Mar 2, 2010

I am rewriting a website for a company who want to keep the existing stock listing format of asp pages pulling info from an uploaded access database. I have left all the asp code alone, just changed the html around it to accommodate a better (albeit not perfect) design than previously used. I have also been adding items to the database exactly the same way the staff do it now.

However, when I view the pages, there is no content, only the html "wrapper". I get the error message displayed where the content should be: "An error occurred on the server when processing the URL. Please contact the system administrator.

If you are the system administrator please click here to find out more about this error."

I am running IIS on my local machine and as far as I am aware, it is configured correctly. I can view asp pages that do not request content from the database fine.

Pages are served on my local machine under
c:inetpubwwwroot
Database is served under
c:inetpubdb

View 1 Replies

Web Forms :: Hiding Repeater On Master Page From Content Page / Access From Content Page?

Oct 6, 2010

My project has the following repeater menu shown on the Master Page. I need this menu to remain hidden until the user logs in. How do I access from content page?

[Code]....

View 2 Replies

Can Content Page Use ContentPlaceHolderID Of Master Parent Of Its Master Page

Sep 29, 2010

I have a 3 level nested master pages and a content page. parent1 is the top parent, parent2 is parent of parent3 and parent3 is the parent of the content page.

I get an error 'Cannot find ContentPlaceHolder xxx...' where xxx is a ContentPlaceholder. It resides in parent2 and content page is trying to fill it.

Can content pages only use their direct parent ContentPlaceHolders or can they also use any of the higher master pages?

View 2 Replies

C# - How To Prevent The Attachment Content From Displaying In The Body Of The Message

Oct 6, 2010

I'm working on an asp.net c# application that sends an email with one attachment.The attachment is a vCalendar file.
Here's the code:

StringBuilder sbCalendar = new StringBuilder();
DateTime dtStart = eventDate;
DateTime dtEnd = eventDate;[code].....

I want to get rid of that text, and display only the contents of my messageBody parameter and have the vCalendar file just attached to the mail message.How can i do this? Is this an outlook issue or a coding issue?

Edit: I'm only interested in displaying the message in Microsoft Outlook. I've looked into the source of the message (in Outlook right click > View Source) and the text i want to get rid of is within the <body></body> html tags of the message)

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved