MVC :: Master Page Show / Hide Links
Sep 13, 2010
I'm fairly new to mvc and I'm just looking for a best practice on hiding action links in the master page depending on the user logged in. Since the master page doesn't receive a model I'm not sure how to pull this off the right (MVC) way.
View 3 Replies
Similar Messages:
Nov 24, 2010
I'm trying to show/hide panels in a masterpage depending on what page the user is on.
I was trying this..
[Code]....
But it didnt work.
View 1 Replies
Nov 22, 2010
Here's an odd one.
I have a master page with links to other pages in the site. Those links use tilde paths (like "~/dir1/page2.aspx"). On most of the pages in the site that use this master page, there is no problem. The problem only seems to be on a few pages that use the master page, the links are VERY wrong, it tries to use the ~ as part of the link (so they are[URL]. It's as if it is treating the tilde as a literal under certain
View 1 Replies
Feb 22, 2010
Only in master file, and only in <link> tag Links.Content.Site_css doesn't work. That is, if I have
[Code]....
If I put the same thing in <title>; or if I put the same link tag in a regular aspx file; or if I use Links.Scripts.jquery_js - everything seems to be working fine. Is there anything specific for resolving <link> tags in master page? I am using MVC 2 RC2
View 4 Replies
Apr 3, 2011
I want to have 4 links in the sidebar of master page which every other form (content page) in my web application inherits.
<table>
<tr>
<td width= "150px">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
<asp:Menu runat="server" ID="MainMenu1" CssClass="MasterContent" StaticSubMenuIndent="30px">
<Items>
<asp:MenuItem Text="My Software" NavigateUrl="~/MySoftware.aspx"></asp:MenuItem>
<asp:MenuItem Text="Check Out" NavigateUrl="~/CheckOut.aspx"></asp:MenuItem>
<asp:MenuItem Text="View Shopping Cart" NavigateUrl="~/ShoppingCart.aspx"></asp:MenuItem>
<asp:MenuItem Text="Continue Shopping" NavigateUrl="~/Start.aspx"></asp:MenuItem>
</Items>
</asp:Menu>
</asp:ContentPlaceHolder>
</td>
<td width="900px">
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
</table>
This is the content in the master page as you can see there are 4 menu items i tried to form as sidebar and i tried to inherit in home.aspx(one of the content pages) as follows:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Start.aspx.cs" Inherits="WebStore._Start"
MasterPageFile="~/Webstore.Master" %>
<asp:Content ID="StartSideBar" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
But unfortunately the sidebar is not at all getting displayed. I know i'm doing fundamentally wrong some where. My intention is to have web pages to have sidebar like this. It is a screenshot of my intended page.
View 1 Replies
Mar 9, 2011
Not sure if the derived page is actually relevant to the problem here, but ran into an interesting gotcha on some code I'm working through at the moment.
I have a custom masterpage class, which derives from System.Web.UI.MasterPage so that it can be extended with additional useful properties. The page that that uses this masterpage has a declaration at the top (note the Page Title being set).
<%@ Page Language="C#" MasterPageFile="~/MasterPages/Landing.master" AutoEventWireup="true" CodeFile="Index.aspx.cs" Inherits="Index" Title="Welcome to the site" %>
In addition, the master page has stylesheet references in the head which are pulled from a CDN that is defined in a config file.
<head id="Head1" runat="server">
<link rel="stylesheet" type="text/css" href="<%= CDN %>/css/main.css" />
</head>
Now the example above obviously doesn't work, because the runat attribute in the head container means that the codeblock in the the link is static text, and renders as is, in the resulting html.
If I remove the runat attribute from head, the CDN works, but now I notice that the Title is no longer being set. If I debug, and try to access Page.Title in the Immediate Window, I get an exception:
// Using the Title property of Page requires a header control on the page. (e.g. <head runat="server" />).
So, is there a way to get the Page Title from the declaration, put my own title placeholder in the head and set it from the master page code-behind, or, is there a better way to dynamically set the CDN domain for the stylesheets? The only way I think I can do that is to build the entire html link tag(s) and append it to the header control, but I thought there might be a more elegant solution, so I'm asking here first.
View 2 Replies
Mar 9, 2011
i want to place a bulleted list with links inside a master page. the problem is that no matter what i do i get an error when i try to press on the link when the link directs me to a page that exists on another folder in my project. (i tried using the ~/some_folder/somewebform.aspx but it didn't work).
View 1 Replies
Mar 4, 2011
I want to be able to sync the footer-links on top level sites and subsites. Currently I have 7 links on top level site and 3 on a subsite and 2 on another sub site. How can I set up the code in my master page so the subsites will show the same footer-links as on the top level site. I know the code has Sharepoint controls in it but it is C#code in a master page. So the concept is still in .NET.Here is the code that I have so far, I am unsure about what should go in this line specifically in the code
[Code]....
Here is the rest of the code
[Code]....
[Code]....
View 25 Replies
Jan 19, 2011
I am working on a functionality of user right, in which admin is selecting the pages and the user and save it. so whenever that user will login into the system then he will be able to see only those pages which were selected and saved for him by the admin.
now for that i have created one page for the list of pages of the application and user list and i am storing them into the database. and then to hide and show the panels i have created the BaseWebPage in my application but here i am not able to get the master page to hide the panel and show only those which are permitted. i dont have much knowledge of BaseWebPage. i am working in framework 2.0 and i have links of all pages that i have shown in a master page in a panel.
View 1 Replies
Jun 5, 2010
The ASP.net 3.5 SiteMapPath Control shows the site map but not necessarily the path thru a site. If a user links from one page to another using a hyperlink, the Site Map does not seem to show the actual path, only the site Map. If this is incorrect, please let me know.If it is correct, do you know of another control that will show the actual path thru the site in a session?
View 8 Replies
Jan 28, 2010
I have one master page that is used to gather information from a user. It contains asp.net labels and textboxes within a table. For example, the master page contains fields for Name , Phone, Address, etc.
There are content pages that are created to add to the information that needs to be gathered. For example, the content page, Loan Application, could ask for Loan Amount, LTV, etc.
In addition to this, certain content page forms do not need to show a particular master page field. For example, the content page may not need to ask for Phone.
The table rows are stored as public properties in the master page so I can hide them in the content page code behind.
public bool HomePhoneRow
{
set { trHomePhone.Visible = value; }
get { return trHomePhone.Visible; }
}
So, in the content page code behind, I have this:
Master.HomePhoneRow = false;
The functionality works perfect, but I don't like how the space is reserved on the page. You can tell that a row was removed. I've tried style="border-collapse:collapse" on both the <table> and <tr> elements. I've also tried to set the row height as a public property and alter that.
View 6 Replies
Mar 19, 2010
I'm building an ASP.Net project that will require the dynamic creation and printing of images. I've been asked to "hide" the header information (which is contained in a master page) when the page is printed. Is this some sort of a property that can be changed when the screen is printing?
The print event is actually running on the client side:
btnPrint.Attributes.Add("onclick",
"JavaScript: window.print(); return false;")
View 1 Replies
Jun 25, 2010
How can I hide a user control on the master page from a content page? This is code I have on my content page's load.
Dim banner As UserControl = DirectCast(Master.FindControl("uc_banner1"), UserControl)
banner.Visible = True
View 1 Replies
Mar 27, 2013
I have master page with ajax accordin menu and I have content page "login.aspx"
In login 2 textbox - username and password , my problem is menu can display only the username and password is correct otherwise it is not display to user
username and password check from the database
View 1 Replies
May 7, 2015
I used the following link for doing the page preloader.
[URL]
I used this code in the master page. So I need to hide the 'loading' and 'modal' in a particular content page. I am able to hide the loading div, but not getting idea for hiding 'modal'.
View 1 Replies
Nov 17, 2010
I have a span tag on my master page which i want to hide after the user logs in. i want to do this after a button click event.
View 2 Replies
Mar 3, 2010
I am working on an app where i am having some linkbuttons in master page. I want to display them depending upon the authorization given to them once they logs in. I have initially made all of them visible false and then i am checking the authorisation in the aspx.cs class of master page. I make the link button visible depending upon the right granted to the user. But it is making all the link buttons visible. Instead it should only make two of them visible and rest should be hidden. Following is my code from MasterPage.aspx.cs:
[Code]....
This is how i use them in aspx file:
[Code]....
View 4 Replies
Feb 2, 2011
i have a multiview having view1 and view2. view1 i have to save some details to my database and view2 i have a gridview. when loading view1 i want to show the save button in the masterpage.if loading view2 save button want to hide from master page
View 3 Replies
Jul 8, 2010
I have a master page (frame.Master) and a content page (default.aspx) that uses frame.Master. Within frame.Master I have an ASP Panel control (pnlQuote). I do not want pnlQuote within frame.Master to be visiable when default.aspx loads. Normally I use the following code within Page_Load of the default.aspx.cs page: this.pnlQuote.Visible = false; however this does not work because pnlQuote is within frame.Master.
correct code to hide pnlQuote within frame.Master when default.aspx is loaded?
View 2 Replies
Sep 17, 2010
I have an user control in master page with id 'ucTopUser' and a button 'btnSub'.I need to hide the both control from my current aspx page.How can I do this?
View 1 Replies
Dec 21, 2010
I need simple JavaScript function that shows hidden div on the center of the screen as modal popup with darked background like jquery dialog or ModalPopupExtender!
example:
[Code]....
View 12 Replies
Aug 11, 2010
I am creating a function to hide all the gridview controls except the control whose name is being passed in the function.
Here this.Controls referes to controls present in the page (At compilation error is thrown although). I want to fetch all the controls of type GridView with Name property not equal to the one passed in the funtion.
Now after getting a collection of GridView. I want to hide all the grids
private void HideGridView(string gridToShow)
{
GridView[] result = from control in this.Controls
where control.GetType() == typeof(GridView) && control.Name !=gridToShow
select control as GridView;
foreach (var control in result)
control.Visible = false;
}
At comile time it shows me this.Control as invalid because it is not a collection.
How can I achieve this on a web application
EDIT:
private void HideGridView(string gridToShow)
{
(from control in this.Controls.OfType<GridView>
where control.Name !=gridToShow
select control).ToList().ForEach(gv=>gv.Visible=false);
}
Here is the code I wrote, shows me an error: GridView is a type but used like a variable (Compile time error).
And at where Invalid Expression Term 'where'
View 2 Replies
Oct 1, 2010
We have a dynamic sitemap and all nodes in the sitemap display a breadcrumb. Is it possible to have the breadcrumb still showing, but make the link in the sitemap invisible or non-clickable? Reason for this is that... we dont want users to select some pages from the sitemap (becasue they need to conduct a search first to populate a datagrid) and clicking on the link will only take them to an empty page. I tried just removing the url, or having a blank title, but that didn't work.
View 14 Replies
Nov 23, 2010
Is there a way to show/hide (visible = true/false) a textbox and/or dropdownlist at PageLoad (or other Page cycle) from codebehind (I would like to check for some permission regarding current user and show/hide some controls from aspx page) ?
View 2 Replies
Oct 19, 2010
[Code]....
show / hide modal dialog box on page load?
View 6 Replies