Search Results

Search found 239 results on 10 pages for 'masterpage'.

Page 3/10 | < Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >

  • asp:login form does not submit when you hit enter

    - by Ben Liyanage
    I am having an issues while using the <asp:login> tag. When a user clicks the "login" button, the form will process correctly. However, when the user hits the enter key, the form self submits and does not process the login, whether it was correct information or not. I am using a combination of MasterPages, and Umbraco. My aspx code looks like this: <%@ Master Language="C#" MasterPageFile="/masterpages/AccountCenter.master" CodeFile="~/masterpages/Login.master.cs" Inherits="LoginPage" AutoEventWireup="true" %> <asp:Content ContentPlaceHolderID="RunwayMasterContentPlaceHolder" runat="server"> <div class="loginBox"> <div class="AspNet-Login-TitlePanel">Account Center Login</div> <asp:label id="output" runat="server"></asp:label> <asp:GridView runat="server" id="GridResults" AutoGenerateColumns="true"></asp:GridView> <asp:Login destinationpageurl="~/dashboard.aspx" ID="Login1" OnLoggedIn="onLogin" runat="server" TitleText="" FailureText="The login/password combination you provided is invalid." DisplayRememberMe="false"></asp:Login> </div> </asp:Content> In the actual rendered page, I see this javascript on the form: <form method="post" action="/dashboard.aspx?" onsubmit="javascript:return WebForm_OnSubmit();" id="aspnetForm"> That javascript function is defined as: <script type="text/javascript"> //<![CDATA[ function WebForm_OnSubmit() { if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false; return true; } //]]> </script> The javascript is always evaluating to True when it runs.

    Read the article

  • ASP.NET control in one content area needs to reference a control in another content area

    - by harrije
    I have a master page that divides the main content into two areas. There are two asp:ContentPlaceHolder controls in the body section of the master page with IDs cphMain and cphSideBar respectively. One of the corresponding content pages has a control in cphMain that needs to refer to a control in cphSideBar. Specifically, a SqlDataSource in cphMain references a TextBox in cphSideBar to use as a parameter in the select command. When the content page loads the following run-time error occurs: Could not find control 'TextBox1' in ControlParameter 'date_con'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: Could not find control 'TextBox1' in ControlParameter 'date_con'. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [InvalidOperationException: Could not find control 'TextBox1' in ControlParameter 'date_con'.] System.Web.UI.WebControls.ControlParameter.Evaluate(HttpContext context, Control control) +1753150 System.Web.UI.WebControls.Parameter.UpdateValue(HttpContext context, Control control) +47 System.Web.UI.WebControls.ParameterCollection.UpdateValues(HttpContext context, Control control) +114 System.Web.UI.WebControls.SqlDataSource.LoadCompleteEventHandler(Object sender, EventArgs e) +43 System.EventHandler.Invoke(Object sender, EventArgs e) +0 System.Web.UI.Page.OnLoadComplete(EventArgs e) +8698566 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +735 I kinda know what the problem is... ASP.NET does not like the fact that the SqlDataSource and TextBox are in different asp:Content controls within the content page. As a workaround, I have another TextBox in cphMain with the SqlDataSource which has Visible=False. Then in the Page_Load() event handler the contents of the TextBox in cphSideBar is copied into the contents of the non-visible TextBox in cphMain. I get the results I want with the work around I've come up with, but it seems like such a hack. I was wondering if there is a better solution I'm missing. Please advise.

    Read the article

  • Accessing a control in asp.net content page through Javascript

    - by rocksolid
    Hi, I have a form in my content page for which I am doing some client side validations via Javascript. The Javascript behaves as expected if I place the JS code directly in the content page. But if I place the JS code in it's own file and try accessing that from the content/master page (through the script tag's src attribute), I get a run time error when the validation function in JS being called. To be specific, I get the below error. Microsoft JScript runtime error: Objected expected/required at this line - document.getElementById('<%=txtemailId.ClientID %').value txtemailId is in the content page. Javascript code is placed in validation.js and accessed via master page. The reason I guess is that when .net is parsing the files, it is unable to substitute txtemailId.ClientID with the client side value that would be generated later on. So, how should one go about it? Thanks!

    Read the article

  • Accessing Session and IPrinciple data in a Master View in Asp.Net MCV

    - by bplus
    I currently have a abstract controller class that I all my controllers inherit from. In my master page I want to be able to access some data that will be in Session and also the currently user (IPrinciple). I read that I could use the contructor of by abstract base controller class, that is I could do something like public BaseController() { ViewData["SomeData"] = Session["SomeData"]; ViewData["UserName"] = this.User.Identity.Name; } I could then access ViewData["UserName"] etc from my master page. My problem is that both Session and User are null at this point. Does anybody know of a different approach? Thanks in advance.

    Read the article

  • Putting a link to a flash object in a template

    - by aron
    I have a asp.net master page that gets used by pages many /levels/deep/ I will put a link to a flash file in this template. I tried doing it like this but it did not work, what the best practice here? <object width="924" height="200"> <param name="movie" value="/live.swf"> <embed src="/live.swf" width="924" height="200"> </object>

    Read the article

  • Is it possible to share a masterpage between MVC and webforms?

    - by Craig Quillen
    I am adding MVC to a project that has MANY legacy webform pages. This works fine. However, I currently have a separate masterpage for MVC and for the webforms. The two master pages produce essentially identical output. I'd really like to kill the webforms one and just use the MVC master page with all my pages and stay DRY. Not being DRY has already bitten me a couple times when I forgot to change both. I tried doing the obvious way and just pointing the webform content page's MasterPage attribute at the MVC masterpage. This throws an error saying the MVC masters only work with MVC views. This seems like it would be a pretty common problem with mixed MVC and webform projects. My MVC master isn't doing anything with ViewData, so I don't see any reason the webforms couldn't use them.

    Read the article

  • ASP.NET how can access public properties of MasterPage from external Class ?

    - by eugeneK
    Why i can't access MasterPage's public property (MessagePlaceholder) from other Class (Errors) ? my master page code behind using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class MyMasterPage : System.Web.UI.MasterPage { public string MessagePlaceholder { get { return messagePlaceholder.InnerHtml; } set { messagePlaceholder.InnerHtml = value; } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { messagePlaceholder.InnerHtml = Errors.getMessage(); } } } my Errors Class public static string getMessage() { HttpContext c = HttpContext.Current; string messageType = ""; if (c.Session["errorMessage"] != null) { messageType = "errorMessage"; } else if (c.Session["successMessage"] != null) { messageType = "successMessage"; } if (!string.IsNullOrEmpty(messageType)) { StringBuilder userMessageSb = new StringBuilder(); userMessageSb.Append(string.Format("<div id=\"{0}\" title=\"{1}\">{2}</div>", messageType, messageType.Replace("Message",string.Empty), c.Session[messageType])); // fix so message will not re-appear c.Session.Remove(messageType); messageType = userMessageSb.ToString(); } return messageType; } public static void setSuccess(string successMessage, bool isRedirect) { HttpContext.Current.Session["successMessage"] = successMessage; } public static void setError(string errorMessage, bool isRedirect) { HttpContext.Current.Session["errorMessage"] = errorMessage; if (!isRedirect) { ((HttpContext.Current.CurrentHandler as System.Web.UI.Page).Master as MyMasterPage).MessagePlaceholder = getMessage(); } } this is how i set error if (true) { Errors.setError("this is an error demo", false); return; } or with redirect after error if (true) { Errors.setError("yet another error", true); Response.Redirect("~/error.aspx"); }

    Read the article

  • how can access public properties of MasterPage from external Class ?

    - by eugeneK
    Why i can't access MasterPage's public property (MessagePlaceholder) from other Class (Errors) ? Error compiler gives me is "Error 1 The type or namespace name 'MyMasterPage' could not be found (are you missing a using directive or an assembly reference?)" my master page code behind using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class MyMasterPage : System.Web.UI.MasterPage { public string MessagePlaceholder { get { return messagePlaceholder.InnerHtml; } set { messagePlaceholder.InnerHtml = value; } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { messagePlaceholder.InnerHtml = Errors.getMessage(); } } } my Errors Class public static string getMessage() { HttpContext c = HttpContext.Current; string messageType = ""; if (c.Session["errorMessage"] != null) { messageType = "errorMessage"; } else if (c.Session["successMessage"] != null) { messageType = "successMessage"; } if (!string.IsNullOrEmpty(messageType)) { StringBuilder userMessageSb = new StringBuilder(); userMessageSb.Append(string.Format("<div id=\"{0}\" title=\"{1}\">{2}</div>", messageType, messageType.Replace("Message",string.Empty), c.Session[messageType])); // fix so message will not re-appear c.Session.Remove(messageType); messageType = userMessageSb.ToString(); } return messageType; } public static void setSuccess(string successMessage, bool isRedirect) { HttpContext.Current.Session["successMessage"] = successMessage; } public static void setError(string errorMessage, bool isRedirect) { HttpContext.Current.Session["errorMessage"] = errorMessage; if (!isRedirect) { ((HttpContext.Current.CurrentHandler as System.Web.UI.Page).Master as MyMasterPage).MessagePlaceholder = getMessage(); } } this is how i set error if (true) { Errors.setError("this is an error demo", false); return; } or with redirect after error if (true) { Errors.setError("yet another error", true); Response.Redirect("~/error.aspx"); }

    Read the article

  • 403 error after adding javascript to masterpage for sharepoint.

    - by Jeremy
    I am attempting to add highslide-with-html.js from http://highslide.com/ to my masterpage. I am receiving a 403 forbidden error when I use the provided masterpage. I have placed it in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033. Test javascript files such as pirate.js which consists solely of alert("Arr!"); have loaded from the same directory. I have provided the code for the masterpage. When I do not reference the problem javascript file there is no 403 error. <%@ Master language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="wssuc" TagName="Welcome" src="~/_controltemplates/Welcome.ascx" %> <%@ Register TagPrefix="wssuc" TagName="DesignModeConsole" src="~/_controltemplates/DesignModeConsole.ascx" %> <%@ Register TagPrefix="PublishingVariations" TagName="VariationsLabelMenu" src="~/_controltemplates/VariationsLabelMenu.ascx" %> <%@ Register Tagprefix="PublishingConsole" TagName="Console" src="~/_controltemplates/PublishingConsole.ascx" %> <%@ Register TagPrefix="PublishingSiteAction" TagName="SiteActionMenu" src="~/_controltemplates/PublishingActionMenu.ascx" %> <html dir="<%$Resources:wss, multipages_direction_dir_value %>" runat="server" __expr-val-dir="ltr"> <head runat="server"> <meta name="GENERATOR" content="Microsoft SharePoint"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Expires" content="0"> <SharePoint:RobotsMetaTag runat="server" __designer:Preview="" __designer:Values="&lt;P N='InDesign' T='False' /&gt;&lt;P N='ID' T='ctl00' /&gt;&lt;P N='Page' ID='1' /&gt;&lt;P N='TemplateControl' ID='2' /&gt;&lt;P N='AppRelativeTemplateSourceDirectory' R='-1' /&gt;"/> <title id="onetidTitle"> <asp:ContentPlaceHolder id="PlaceHolderPageTitle" runat="server"/> </title> <Sharepoint:CssLink runat="server" __designer:Preview="&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/Style%20Library/en-US/Core%20Styles/Band.css&quot;/&gt; &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/Style%20Library/en-US/Core%20Styles/controls.css&quot;/&gt; &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/Style%20Library/zz1_blue.css&quot;/&gt; &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/_layouts/1033/styles/core.css&quot;/&gt; " __designer:Values="&lt;P N='InDesign' T='False' /&gt;&lt;P N='ID' T='ctl01' /&gt;&lt;P N='Page' ID='1' /&gt;&lt;P N='TemplateControl' ID='2' /&gt;&lt;P N='AppRelativeTemplateSourceDirectory' R='-1' /&gt;"/> <!--Styles used for positioning, font and spacing definitions--> <SharePoint:CssRegistration name="<% $SPUrl:~SiteCollection/Style Library/~language/Core Styles/Band.css%>" runat="server" __designer:Preview="&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/Style%20Library/en-US/Core%20Styles/Band.css&quot;/&gt; " __designer:Values="&lt;P N='Name' Bound='True' T='SPUrl:~SiteCollection/Style Library/~language/Core Styles/Band.css' /&gt;&lt;P N='InDesign' T='False' /&gt;&lt;P N='ID' T='ctl02' /&gt;&lt;P N='Page' ID='1' /&gt;&lt;P N='TemplateControl' ID='2' /&gt;&lt;P N='AppRelativeTemplateSourceDirectory' R='-1' /&gt;"/> <SharePoint:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/~language/Core Styles/controls.css %>" runat="server" __designer:Preview="&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/Style%20Library/en-US/Core%20Styles/controls.css&quot;/&gt; " __designer:Values="&lt;P N='Name' Bound='True' T='SPUrl:~sitecollection/Style Library/~language/Core Styles/controls.css' /&gt;&lt;P N='InDesign' T='False' /&gt;&lt;P N='ID' T='ctl03' /&gt;&lt;P N='Page' ID='1' /&gt;&lt;P N='TemplateControl' ID='2' /&gt;&lt;P N='AppRelativeTemplateSourceDirectory' R='-1' /&gt;"/> <SharePoint:CssRegistration name="<% $SPUrl:~SiteCollection/Style Library/zz1_blue.css%>" runat="server" __designer:Preview="&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/Style%20Library/zz1_blue.css&quot;/&gt; " __designer:Values="&lt;P N='Name' Bound='True' T='SPUrl:~SiteCollection/Style Library/zz1_blue.css' /&gt;&lt;P N='InDesign' T='False' /&gt;&lt;P N='ID' T='ctl04' /&gt;&lt;P N='Page' ID='1' /&gt;&lt;P N='TemplateControl' ID='2' /&gt;&lt;P N='AppRelativeTemplateSourceDirectory' R='-1' /&gt;"/> <SharePoint:ScriptLink name="init.js" runat="server" __designer:Preview="&lt;script src=&quot;/_layouts/1033/init.js?rev=VhAxGc3rkK79RM90tibDzw%3D%3D&quot;&gt;&lt;/script&gt; " __designer:Values="&lt;P N='Name' T='init.js' /&gt;&lt;P N='InDesign' T='False' /&gt;&lt;P N='ID' T='ctl05' /&gt;&lt;P N='Page' ID='1' /&gt;&lt;P N='TemplateControl' ID='2' /&gt;&lt;P N='AppRelativeTemplateSourceDirectory' R='-1' /&gt;"/> <SharePoint:ScriptLink Name="highslide-with-html.js" runat="server" __designer:Error="Access to the path 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\layouts\1033\highslide-with-html.js' is denied."/> <!--Placeholder for additional overrides--> <asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server"/> </head> <body class="body" onload="javascript:_spBodyOnLoadWrapper();"> <WebPartPages:SPWebPartManager runat="server"/> <form runat="server" onsubmit="return _spFormOnSubmitWrapper();"> <table cellpadding="0" cellspacing="0" class="master"> <tr> <td height="100%" class="shadowLeft"> <div class="spacer"> </div> </td> <td valign="top"> <table cellpadding="0" cellspacing="0" width="100%" class="masterContent"> <tr style="height:0px"><td> <wssuc:DesignModeConsole id="IdDesignModeConsole" runat="server" __designer:Preview="&lt;span __designer:NonVisual=&quot;true&quot;&gt;[ DesignModeConsoleContainer &quot;DesignModeContainer&quot; ]&lt;/span&gt; " __designer:Values="&lt;P N='ID' ID='1' T='IdDesignModeConsole' /&gt;&lt;P N='TemplateControl' R='0' /&gt;"/></td></tr> <tr> <td colspan="2" class="authoringRegion"> <span class="siteActionMenu"> <PublishingSiteAction:SiteActionMenu runat="server" __designer:Preview=" &lt;!-- Begin Action Menu Markup --&gt; &lt;table height=100% class=&quot;ms-siteaction&quot; cellpadding=0 cellspacing=0&gt; &lt;tr&gt; &lt;td class=&quot;ms-siteactionsmenu&quot; id=&quot;siteactiontd&quot;&gt; &lt;span style=&quot;display:none&quot;&gt;&lt;menu type='ServerMenu' id=&quot;zz1_SiteActionsMenuMain&quot; largeIconMode=&quot;true&quot;&gt;&lt;ie:menuitem id=&quot;zz2_MenuItem_Create&quot; type=&quot;option&quot; iconSrc=&quot;/_layouts/images/Actionscreate.gif&quot; onMenuClick=&quot;window.location = '/_layouts/create.aspx';&quot; menuGroupId=&quot;100&quot;&gt;&lt;/ie:menuitem&gt;&lt;ie:menuitem id=&quot;zz3_MenuItem_Settings&quot; type=&quot;option&quot; iconSrc=&quot;/_layouts/images/ActionsSettings.gif&quot; onMenuClick=&quot;window.location = '/_layouts/settings.aspx';&quot; menuGroupId=&quot;100&quot;&gt;&lt;/ie:menuitem&gt;&lt;/menu&gt;&lt;/span&gt;&lt;div&gt;&lt;div&gt;&lt;span title=&quot;Open Menu&quot;&gt;&lt;div id=&quot;zz4_SiteActionsMenu_t&quot; class=&quot;&quot; onmouseover=&quot;MMU_PopMenuIfShowing(this);MMU_EcbTableMouseOverOut(this, true)&quot; hoverActive=&quot;ms-siteactionsmenuhover&quot; hoverInactive=&quot;&quot; onclick=&quot; MMU_Open(byid(''), MMU_GetMenuFromClientId('zz4_SiteActionsMenu'),event,false, null, 0);&quot; foa=&quot;MMU_GetMenuFromClientId('zz4_SiteActionsMenu')&quot; oncontextmenu=&quot;this.click(); return false;&quot; nowrap=&quot;nowrap&quot;&gt;&lt;a id=&quot;zz4_SiteActionsMenu&quot; accesskey=&quot;/&quot; href=&quot;#&quot; onclick=&quot;javascript:return false;&quot; style=&quot;cursor:pointer;white-space:nowrap;&quot; onfocus=&quot;MMU_EcbLinkOnFocusBlur(byid(''), this, true);&quot; onkeydown=&quot;MMU_EcbLinkOnKeyDown(byid(''), MMU_GetMenuFromClientId('zz4_SiteActionsMenu'), event);&quot; onclick=&quot; MMU_Open(byid(''), MMU_GetMenuFromClientId('zz4_SiteActionsMenu'),event,false, null, 0);&quot; oncontextmenu=&quot;this.click(); return false;&quot; menuTokenValues=&quot;MENUCLIENTID=zz4_SiteActionsMenu,TEMPLATECLIENTID=zz1_SiteActionsMenuMain&quot; serverclientid=&quot;zz4_SiteActionsMenu&quot;&gt;Site Actions&lt;img src=&quot;/_layouts/images/blank.gif&quot; border=&quot;0&quot; alt=&quot;Use SHIFT+ENTER to open the menu (new window).&quot;/&gt;&lt;/a&gt;&lt;img align=&quot;absbottom&quot; src=&quot;/_layouts/images/whitearrow.gif&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;!-- End Action Menu Markup --&gt; " __designer:Values="&lt;P N='TemplateControl' R='0' /&gt;"/> </span> <div class="sharepointLogin"> <!--Authentication for Authors only--> <table cellpadding="0" cellspacing="0" > <tr> <td class="ms-globallinks"> <SharePoint:DelegateControl ControlId="GlobalSiteLink1" Scope="Farm" runat="server" __designer:Preview="&lt;span style='padding-left:3px'&gt;&lt;/span&gt; &lt;a id=&quot;ctl00_ctl09_hlMySite&quot; href=&quot;http://litwaredemo:80/MySite/_layouts/MySite.aspx&quot;&gt;My Site&lt;/a&gt; &lt;span style='padding-left:4px;padding-right:3px'&gt;|&lt;/span&gt; " __designer:Values="&lt;P N='ControlId' T='GlobalSiteLink1' /&gt;&lt;P N='Scope' T='Farm' /&gt;&lt;P N='ID' T='ctl08' /&gt;&lt;P N='Page' ID='1' /&gt;&lt;P N='TemplateControl' ID='2' /&gt;&lt;P N='AppRelativeTemplateSourceDirectory' R='-1' /&gt;"/></td> <td class="ms-globallinks"> <SharePoint:DelegateControl ControlId="GlobalSiteLink2" Scope="Farm" runat="server" __designer:Preview="&lt;span id=&quot;ctl00_ctl11_MyLinksMenu&quot;&gt;&lt;span style=&quot;display:none&quot;&gt;&lt;menu type='ServerMenu' id=&quot;ctl00_ctl11_MyLinksMenuMenuTemplate&quot; largeIconMode=&quot;true&quot;&gt;&lt;/menu&gt;&lt;/span&gt;&lt;span title=&quot;Open Menu&quot;&gt;&lt;span id=&quot;ctl00_ctl11_MyLinksMenuMenu_t&quot; class=&quot;ms-SPLink ms-hovercellinactive&quot; onmouseover=&quot;MMU_PopMenuIfShowing(this);MMU_EcbTableMouseOverOut(this, true)&quot; hoverActive=&quot;ms-SPLink ms-hovercellactive&quot; hoverInactive=&quot;ms-SPLink ms-hovercellinactive&quot; onclick=&quot;javascript:FetchCallbackMenuItems(&amp;#39;ctl00_ctl11_MyLinksMenuMenuTemplate&amp;#39;); MMU_Open(byid('ctl00_ctl11_MyLinksMenuMenuTemplate'), MMU_GetMenuFromClientId('ctl00_ctl11_MyLinksMenuMenu'),event,true, null, 0);&quot; foa=&quot;MMU_GetMenuFromClientId('ctl00_ctl11_MyLinksMenuMenu')&quot; oncontextmenu=&quot;this.click(); return false;&quot; nowrap=&quot;nowrap&quot;&gt;&lt;a id=&quot;ctl00_ctl11_MyLinksMenuMenu&quot; accesskey=&quot;M&quot; href=&quot;#&quot; onclick=&quot;javascript:return false;&quot; style=&quot;cursor:pointer;white-space:nowrap;&quot; onfocus=&quot;MMU_EcbLinkOnFocusBlur(byid('ctl00_ctl11_MyLinksMenuMenuTemplate'), this, true);&quot; onkeydown=&quot;MMU_EcbLinkOnKeyDown(byid('ctl00_ctl11_MyLinksMenuMenuTemplate'), MMU_GetMenuFromClientId('ctl00_ctl11_MyLinksMenuMenu'), event);&quot; onclick=&quot;javascript:FetchCallbackMenuItems(&amp;#39;ctl00_ctl11_MyLinksMenuMenuTemplate&amp;#39;); MMU_Open(byid('ctl00_ctl11_MyLinksMenuMenuTemplate'), MMU_GetMenuFromClientId('ctl00_ctl11_MyLinksMenuMenu'),event,true, null, 0);&quot; oncontextmenu=&quot;this.click(); return false;&quot; menuTokenValues=&quot;MENUCLIENTID=ctl00_ctl11_MyLinksMenuMenu,TEMPLATECLIENTID=ctl00_ctl11_MyLinksMenuMenuTemplate&quot; serverclientid=&quot;ctl00_ctl11_MyLinksMenuMenu&quot;&gt;My Links&lt;img src=&quot;/_layouts/images/blank.gif&quot; border=&quot;0&quot; alt=&quot;Use SHIFT+ENTER to open the menu (new window).&quot;/&gt;&lt;/a&gt;&lt;img align=&quot;absbottom&quot; src=&quot;/_layouts/images/menudark.gif&quot; alt=&quot;&quot; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;|" __designer:Values="&lt;P N='ControlId' T='GlobalSiteLink2' /&gt;&lt;P N='Scope' T='Farm' /&gt;&lt;P N='ID' T='ctl10' /&gt;&lt;P N='Page' ID='1' /&gt;&lt;P N='TemplateControl' ID='2' /&gt;&lt;P N='AppRelativeTemplateSourceDirectory' R='-1' /&gt;"/></td> <td class="ms-globallinks"> <wssuc:Welcome id="explitLogout" runat="server" __designer:Preview=" &lt;span style=&quot;display:none&quot;&gt;&lt;menu type='ServerMenu' id=&quot;zz5_ID_PersonalActionMenu&quot; largeIconMode=&quot;true&quot;&gt;&lt;ie:menuitem id=&quot;zz6_ID_PersonalInformation&quot; type=&quot;option&quot; iconSrc=&quot;/_layouts/images/menuprofile.gif&quot; onMenuClick=&quot;javascript:GoToPage('\u002f_layouts\u002fuserdisp.aspx?Force=True\u0026ID=' + _spUserId);return false;&quot; menuGroupId=&quot;100&quot;&gt;&lt;/ie:menuitem&gt;&lt;ie:menuitem id=&quot;zz7_ID_LoginAsDifferentUser&quot; type=&quot;option&quot; onMenuClick=&quot;javascript:LoginAsAnother('\u002f_layouts\u002fAccessDenied.aspx?loginasanotheruser=true', 0)&quot; menuGroupId=&quot;200&quot;&gt;&lt;/ie:menuitem&gt;&lt;ie:menuitem id=&quot;zz8_ID_RequestAccess&quot; type=&quot;option&quot; onMenuClick=&quot;window.location = '/_layouts/reqacc.aspx?type=list&amp;amp;name=%7B36F0105B%2D0F8E%2D4A22%2DBE90%2D716A51E97B5D%7D';&quot; menuGroupId=&quot;200&quot;&gt;&lt;/ie:menuitem&gt;&lt;ie:menuitem id=&quot;zz9_ID_Logout&quot; type=&quot;option&quot; onMenuClick=&quot;window.location = '/_layouts/SignOut.aspx';&quot; menuGroupId=&quot;200&quot;&gt;&lt;/ie:menuitem&gt;&lt;/menu&gt;&lt;/span&gt;&lt;span title=&quot;Open Menu&quot;&gt;&lt;div id=&quot;zz10_Menu_t&quot; class=&quot;ms-SPLink ms-SpLinkButtonInActive&quot; onmouseover=&quot;MMU_PopMenuIfShowing(this);MMU_EcbTableMouseOverOut(this, true)&quot; hoverActive=&quot;ms-SPLink ms-SpLinkButtonActive&quot; hoverInactive=&quot;ms-SPLink ms-SpLinkButtonInActive&quot; onclick=&quot; MMU_Open(byid(''), MMU_GetMenuFromClientId('zz10_Menu'),event,false, null, 0);&quot; foa=&quot;MMU_GetMenuFromClientId('zz10_Menu')&quot; oncontextmenu=&quot;this.click(); return false;&quot; nowrap=&quot;nowrap&quot;&gt;&lt;a id=&quot;zz10_Menu&quot; accesskey=&quot;L&quot; href=&quot;#&quot; onclick=&quot;javascript:return false;&quot; style=&quot;cursor:pointer;white-space:nowrap;&quot; onfocus=&quot;MMU_EcbLinkOnFocusBlur(byid(''), this, true);&quot; onkeydown=&quot;MMU_EcbLinkOnKeyDown(byid(''), MMU_GetMenuFromClientId('zz10_Menu'), event);&quot; onclick=&quot; MMU_Open(byid(''), MMU_GetMenuFromClientId('zz10_Menu'),event,false, null, 0);&quot; oncontextmenu=&quot;this.click(); return false;&quot; menuTokenValues=&quot;MENUCLIENTID=zz10_Menu,TEMPLATECLIENTID=zz5_ID_PersonalActionMenu&quot; serverclientid=&quot;zz10_Menu&quot;&gt;Welcome LitwareInc Administrator&lt;img src=&quot;/_layouts/images/blank.gif&quot; border=&quot;0&quot; alt=&quot;Use SHIFT+ENTER to open the menu (new window).&quot;/&gt;&lt;/a&gt;&lt;img align=&quot;absbottom&quot; src=&quot;/_layouts/images/menudark.gif&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;&lt;/span&gt;&lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;var _spUserId=1;&lt;/script&gt; &lt;a id=&quot;explitLogout_ExplicitLogin&quot; Href=&quot;_controltemplates/http://litwaredemo/_layouts/Authenticate.aspx&quot; style=&quot;display:none&quot;&gt;Sign In&lt;/a&gt; " __designer:Values="&lt;P N='ID' ID='1' T='explitLogout' /&gt;&lt;P N='TemplateControl' R='0' /&gt;"/></td> </tr> </table> </div> <div class="console"> <PublishingConsole:Console runat="server" __designer:Preview=" &lt;!-- Console --&gt; &lt;span id=&quot;ctl00_publishingContext1&quot;&gt;&lt;/span&gt; &lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;if (document.getElementById('mpdmconsole')) { ShowConsoleBlockPaddingWithOverhang('mpLeftBackPadding', 'mpRightBackPadding', 'masterPageLeftOverhang', 'masterPageRightOverhang'); } &lt;/script&gt; &lt;!-- Console --&gt; " __designer:Values="&lt;P N='TemplateControl' R='0' /&gt;"/> </div> </td> </tr> <tr> <td colspan="2" > <table cellpadding="0" cellspacing="0" width="100%"> <tr> <td colspan="4" class="topArea"> <SharePoint:AspMenu ID="logoLinkId" runat="server" DataSourceID="SiteMapDataSourceRoot" StaticDisplayLevels="1" MaximumDynamicDisplayLevels="0" AccessKey="1" CssClass="logo" __designer:Preview="&lt;table id=&quot;zz12_logoLinkId&quot; class=&quot;logo&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;&gt; &lt;tr id=&quot;zz12_logoLinkIdn0&quot;&gt; &lt;td&gt;&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot;&gt; &lt;tr&gt; &lt;td style=&quot;white-space:nowrap;width:100%;&quot;&gt;&lt;a Href=&quot;/Pages/Default.aspx&quot; accesskey=&quot;1&quot; style=&quot;text-decoration:none;&quot;&gt;Home&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;" __designer:Values="&lt;P N='ID' T='logoLinkId' /&gt;&lt;P N='MaximumDynamicDisplayLevels' T='0' /&gt;&lt;P N='DataSourceID' T='SiteMapDataSourceRoot' /&gt;&lt;P N='AccessKey' T='1' /&gt;&lt;P N='ControlStyle'&gt;&lt;P N='CssClass' ID='1' T='logo' /&gt;&lt;P N='Font' ID='2' /&gt;&lt;P N='IsEmpty' T='False' /&gt;&lt;/P&gt;&lt;P N='CssClass' R='1' /&gt;&lt;P N='Font' R='2' /&gt;&lt;P N='Page' ID='3' /&gt;&lt;P N='TemplateControl' ID='4' /&gt;&lt;P N='AppRelativeTemplateSourceDirectory' R='-1' /&gt;" __designer:Templates="&lt;Group Name=&quot;Item Templates&quot;&gt;&lt;Template Name=&quot;StaticItemTemplate&quot; Flags=&quot;D&quot; Content=&quot;&quot; /&gt;&lt;Template Name=&quot;DynamicItemTemplate&quot; Flags=&quot;D&quot; Content=&quot;&quot; /&gt;&lt;/Group&gt;"/> <PublishingNavigation:PortalSiteMapDataSource ID="SiteMapDataSourceRoot" Runat="server" SiteMapProvider="CombinedNavSiteMapProvider" EnableViewState="true" StartFromCurrentNode="true" StartingNodeOffset="0" ShowStartingNode="true" __designer:Preview="&lt;table cellpadding=4 cellspacing=0 style=&quot;font:messagebox;color:buttontext;background-color:buttonface;border: solid 1px;border-top-color:buttonhighlight;border-left-color:buttonhighlight;border-bottom-color:buttonshadow;border-right-color:buttonshadow&quot;&gt; &lt;tr&gt;&lt;td nowrap&gt;&lt;span style=&quot;font-weight:bold&quot;&gt;PortalSiteMapDataSource&lt;/span&gt; - SiteMapDataSourceRoot&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt;" __designer:Values="&lt;P N='ID' T='SiteMapDataSourceRoot' /&gt;&lt;P N='SiteMapProvider' T='CombinedNavSiteMapProvider' /&gt;&lt;P N='StartFromCurrentNode' T='True' /&gt;&lt;P N='Page' ID='1' /&gt;&lt;P N='TemplateControl' ID='2' /&gt;&lt;P N='AppRelativeTemplateSourceDirectory' R='-1' /&gt;"/> <div class="topLinkBar"> <div class="topLink"> <PublishingVariations:VariationsLabelMenu id="labelmenu1" runat="server" __designer:Preview="&lt;span __designer:NonVisual=&quot;true&quot;&gt;&lt;table cellpadding=4 cellspacing=0 style=&quot;font:messagebox;color:buttontext;background-color:buttonface;border: solid 1px;border-top-color:buttonhighlight;border-left-color:buttonhighlight;border-bottom-color:buttonshadow;border-right-color:buttonshadow&quot;&gt; &lt;tr&gt;&lt;td nowrap&gt;&lt;span style=&quot;font-weight:bold&quot;&gt;VariationDataSource&lt;/span&gt; - LabelMenuDataSource&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt;&lt;/span&gt; " __designer:Values="&lt;P N='ID' ID='1' T='labelmenu1' /&gt;&lt;P N='TemplateControl' R='0' /&gt;"/> </div> </div> </td> </tr> <tr class="topNavContainer"> <td class="topNavRoundLeft"> <div class="glassSpacerLeft" /> </td> <td valign="top" width="100%"> <SharePoint:AspMenu ID="GlobalNav" Runat="server" DataSourceID="SiteMapDataSource1" Orientation="Horizontal" StaticDisplayLevels="1" MaximumDynamicDisplayLevels="1" StaticSubMenuIndent="0" DynamicHorizontalOffset="0" DynamicVerticalOffset="-8" StaticEnableDefaultPopOutImage="false" ItemWrap="false" SkipLinkText="<%$Resources:cms,masterpages_skiplinktext%>" CssClass="topNav" __designer:Preview="&lt;table id=&quot;zz13_GlobalNav&quot; class=&quot;topNav&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;&gt; &lt;tr&gt; &lt;td title=&quot;Document Center site&quot; id=&quot;zz13_GlobalNavn0&quot;&gt;&lt;table class=&quot;topNavItem&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot;&gt; &lt;tr&gt; &lt;td style=&quot;white-space:nowrap;&quot;&gt;&lt;a class=&quot;topNavItem&quot; Href=&quot;/Docs&quot; style=&quot;text-decoration:none;border-style:none;&quot;&gt;Document Center&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;&lt;/td&gt;&lt;td style=&quot;width:0px;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;width:0px;&quot;&gt;&lt;/td&gt;&lt;td title=&quot;Company News Home&quot; id=&quot;zz13_GlobalNavn1&quot;&gt;&lt;table class=&quot;topNavItem&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot;&gt; &lt;tr&gt; &lt;td style=&quot;white-space:nowrap;&quot;&gt;&lt;a class=&quot;topNavItem&quot; Href=&quot;/News/Pages/Default.aspx&quot; style=&quot;text-decoration:none;border-style:none;&quot;&gt;News&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;&lt;/td&gt;&lt;td style=&quot;width:0px;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;width:0px;&quot;&gt;&lt;/td&gt;&lt;td title=&quot;Report Center&quot; id=&quot;zz13_GlobalNavn2&quot;&gt;&lt;table class=&quot;topNavItem&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot;&gt; &lt;tr&gt; &lt;td style=&quot;white-space:nowrap;&quot;&gt;&lt;a class=&quot;topNavItem&quot; Href=&quot;/Reports/Pages/Default.aspx&quot; style=&quot;text-decoration:none;border-style:none;&quot;&gt;Reports&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;&lt;/td&gt;&lt;td style=&quot;width:0px;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;width:0px;&quot;&gt;&lt;/td&gt;&lt;td title=&quot;The Search Center displays search results&quot; id=&quot;zz13_GlobalNavn3&quot;&gt;&lt;table class=&quot;topNavItem&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot;&gt; &lt;tr&gt; &lt;td style=&quot;white-space:nowrap;&quot;&gt;&lt;a class=&quot;topNavItem&quot; Href=&quot;/SearchCenter/Pages/default.aspx&quot; style=&quot;text-decoration:none;border-style:none;&quot;&gt;Search&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;&lt;/td&gt;&lt;td style=&quot;width:0px;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;width:0px;&quot;&gt;&lt;/td&gt;&lt;td title=&quot;Site Directory web&quot; id=&quot;zz13_GlobalNavn4&quot;&gt;&lt;table class=&quot;topNavItem&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot;&gt; &lt;tr&gt; &lt;td style=&quot;white-space:nowrap;&quot;&gt;&lt;a class=&quot;topNavItem&quot; Href=&quot;/SiteDirectory/Pages/category.aspx&quot; style=&quot;text-decoration:none;border-style:none;&quot;&gt;Sites&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;&lt;/td&gt;&lt;td style=&quot;width:0px;&quot;&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;" __designer:Values="&lt;P N='ID' T='GlobalNav' /&gt;&lt;P N='DynamicHoverStyle'&gt;&lt;P N='CssClass' T='topNavFlyOutsHover' /&gt;&lt;P N='IsEmpty' T='False' /&gt;&lt;/P&gt;&lt;P N='DynamicMenuItemStyle'&gt;&lt;P N='CssClass' T='topNavFlyOutsItem' /&gt;&lt;P N='IsEmpty' T='False' /&gt;&lt;/P&gt;&lt;P N='DynamicMenuStyle'&gt;&lt;P N='CssClass' T='topNavFlyOuts' /&gt;&lt;P N='IsEmpty' T='False' /&gt;&lt;/P&gt;&lt;P N='DynamicVerticalOffset' T='-8' /&gt;&lt;P N='MaximumDynamicDisplayLevels' T='1' /&gt;&lt;P N='Orientation' E='0' /&gt;&lt;P N='SkipLinkText' Bound='True' T='Resources:cms,masterpages_skiplinktext' /&gt;&lt;P N='StaticEnableDefaultPopOutImage' T='False' /&gt;&lt;P N='StaticHoverStyle'&gt;&lt;P N='CssClass' T='topNavHover' /&gt;&lt;P N='IsEmpty' T='False' /&gt;&lt;/P&gt;&lt;P N='StaticMenuItemStyle'&gt;&lt;P N='CssClass' T='topNavItem' /&gt;&lt;P N='ItemSpacing' T='0px' /&gt;&lt;P N='IsEmpty' T='False' /&gt;&lt;/P&gt;&lt;P N='StaticSelectedStyle'&gt;&lt;P N='CssClass' T='topNavSelected' /&gt;&lt;P N='ItemSpacing' T='0px' /&gt;&lt;P N='IsEmpty' T='False' /&gt;&lt;/P&gt;&lt;P N='StaticSubMenuIndent' T='0px' /&gt;&lt;P N='DataSourceID' T='SiteMapDataSource1' /&gt;&lt;P N='ControlStyle'&gt;&lt;P N='CssClass' ID='1' T='topNav' /&gt;&lt;P N='Font' ID='2' /&gt;&lt;P N='IsEmpty' T='False' /&gt;&lt;/P&gt;&lt;P N='CssClass' R='1' /&gt;&lt;P N='Font' R='2' /&gt;&lt;P N='Page' ID='3' /&gt;&lt;P N='TemplateControl' ID='4' /&gt;&lt;P N='AppRelativeTemplateSourceDirectory' R='-1' /&gt;" __designer:Templates="&lt;Group Name=&quot;Item Templates&quot;&gt;&lt;Template Name=&quot;StaticItemTemplate&quot; Flags=&quot;D&quot; Content=&quot;&quot; /&gt;&lt;Template Name=&quot;DynamicItemTemplate&quot; Flags=&quot;D&quot; Content=&quot;&quot; /&gt;&lt;/Group&gt;"> <StaticMenuItemStyle CssClass="topNavItem" ItemSpacing="0"/> <StaticSelectedStyle CssClass="topNavSelected" ItemSpacing="0"/> <StaticHoverStyle CssClass="topNavHover"/> <DynamicMenuStyle CssClass="topNavFlyOuts" /> <DynamicMenuItemStyle CssClass="topNavFlyOutsItem" /> <DynamicHoverStyle CssClass="topNavFlyOutsHover"/> </SharePoint:AspMenu> <PublishingNavigation:PortalSiteMapDataSource ID="siteMapDataSource1" Runat="server" SiteMapProvider="CombinedNavSiteMapProvider" EnableViewState="true" StartFromCurrentNode="true" StartingNodeOffset="0" ShowStartingNode="false" TreatStartingNodeAsCurrent="true" TrimNonCurrentTypes="Heading" __designer:Preview="&lt;table cellpadding=4 cellspacing=0 style=&quot;font:messagebox;color:buttontext;background-color:buttonface;border: solid 1px;border-top-color:buttonhighlight;border-left-color:buttonhighlight;border-bottom-color:buttonshadow;border-right-color:buttonshadow&quot;&gt; &lt;tr&gt;&lt;td nowrap&gt;&lt;span style=&quot;font-weight:bold&quot;&gt;PortalSiteMapDataSource&lt;/span&gt; - siteMapDataSource1&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt;" __designer:Values="&lt;P N='ID' T='siteMapDataSource1' /&gt;&lt;P N='SiteMapProvider' T='CombinedNavSiteMapProvider' /&gt;&lt;P N='StartFromCurrentNode' T='True' /&gt;&lt;P N='ShowStartingNode' T='False' /&gt;&lt;P N='TreatStartingNodeAsCurrent' T='True' /&gt;&lt;P N='TrimNonCurrentTypes' E='32' /&gt;&lt;P N='Page' ID='1' /&gt;&lt;P N='TemplateControl' ID='2' /&gt;&lt;P N='AppRelativeTemplateSourceDirectory' R='-1' /&gt;"/> </td> <td> <div class="search"> <asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server"> <SPSWC:SearchBoxEx id="SearchBox" RegisterStyles="false" TextBeforeDropDown="" TextBeforeTextBox="<%$Resources:cms,masterpages_searchbox_label%>" TextBoxWidth="100" GoImageUrl="<% $SPUrl:~sitecollection/Style Library/Images/Search_Arrow.jpg %>" GoImageUrlRTL="<% $SPUrl:~sitecollection/Style Library/Images/Search_Arrow_RTL.jpg %>" UseSiteDefaults="true" DropDownMode = "HideScopeDD" SuppressWebPartChrome="true" runat="server" WebPart="true" __WebPartId="{7DECDCCA-FDA0-4739-8F0E-7B8DE48F0E0D}" __Preview="&lt;table TOPLEVEL border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot;&gt; &lt;tr&gt; &lt;td&gt;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot;&gt; &lt;tr class=&quot;ms-WPHeader&quot;&gt; &lt;td title=&quot;&quot; id=&quot;WebPart

    Read the article

  • MVC Portable Area Modules *Without* MasterPages

    - by Steve Michelotti
    Portable Areas from MvcContrib provide a great way to build modular and composite applications on top of MVC. In short, portable areas provide a way to distribute MVC binary components as simple .NET assemblies where the aspx/ascx files are actually compiled into the assembly as embedded resources. I’ve blogged about Portable Areas in the past including this post here which talks about embedding resources and you can read more of an intro to Portable Areas here. As great as Portable Areas are, the question that seems to come up the most is: what about MasterPages? MasterPages seems to be the one thing that doesn’t work elegantly with portable areas because you specify the MasterPage in the @Page directive and it won’t use the same mechanism of the view engine so you can’t just embed them as resources. This means that you end up referencing a MasterPage that exists in the host application but not in your portable area. If you name the ContentPlaceHolderId’s correctly, it will work – but it all seems a little fragile. Ultimately, what I want is to be able to build a portable area as a module which has no knowledge of the host application. I want to be able to invoke the module by a full route on the user’s browser and it gets invoked and “automatically appears” inside the application’s visual chrome just like a MasterPage. So how could we accomplish this with portable areas? With this question in mind, I looked around at what other people are doing to address similar problems. Specifically, I immediately looked at how the Orchard team is handling this and I found it very compelling. Basically Orchard has its own custom layout/theme framework (utilizing a custom view engine) that allows you to build your module without any regard to the host. You simply decorate your controller with the [Themed] attribute and it will render with the outer chrome around it: 1: [Themed] 2: public class HomeController : Controller Here is the slide from the Orchard talk at this year MIX conference which shows how it conceptually works:   It’s pretty cool stuff.  So I figure, it must not be too difficult to incorporate this into the portable areas view engine as an optional piece of functionality. In fact, I’ll even simplify it a little – rather than have 1) Document.aspx, 2) Layout.ascx, and 3) <view>.ascx (as shown in the picture above); I’ll just have the outer page be “Chrome.aspx” and then the specific view in question. The Chrome.aspx not only takes the place of the MasterPage, but now since we’re no longer constrained by the MasterPage infrastructure, we have the choice of the Chrome.aspx living in the host or inside the portable areas as another embedded resource! Disclaimer: credit where credit is due – much of the code from this post is me re-purposing the Orchard code to suit my needs. To avoid confusion with Orchard, I’m going to refer to my implementation (which will be based on theirs) as a Chrome rather than a Theme. The first step I’ll take is to create a ChromedAttribute which adds a flag to the current HttpContext to indicate that the controller designated Chromed like this: 1: [Chromed] 2: public class HomeController : Controller The attribute itself is an MVC ActionFilter attribute: 1: public class ChromedAttribute : ActionFilterAttribute 2: { 3: public override void OnActionExecuting(ActionExecutingContext filterContext) 4: { 5: var chromedAttribute = GetChromedAttribute(filterContext.ActionDescriptor); 6: if (chromedAttribute != null) 7: { 8: filterContext.HttpContext.Items[typeof(ChromedAttribute)] = null; 9: } 10: } 11:   12: public static bool IsApplied(RequestContext context) 13: { 14: return context.HttpContext.Items.Contains(typeof(ChromedAttribute)); 15: } 16:   17: private static ChromedAttribute GetChromedAttribute(ActionDescriptor descriptor) 18: { 19: return descriptor.GetCustomAttributes(typeof(ChromedAttribute), true) 20: .Concat(descriptor.ControllerDescriptor.GetCustomAttributes(typeof(ChromedAttribute), true)) 21: .OfType<ChromedAttribute>() 22: .FirstOrDefault(); 23: } 24: } With that in place, we only have to override the FindView() method of the custom view engine with these 6 lines of code: 1: public override ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache) 2: { 3: if (ChromedAttribute.IsApplied(controllerContext.RequestContext)) 4: { 5: var bodyView = ViewEngines.Engines.FindPartialView(controllerContext, viewName); 6: var documentView = ViewEngines.Engines.FindPartialView(controllerContext, "Chrome"); 7: var chromeView = new ChromeView(bodyView, documentView); 8: return new ViewEngineResult(chromeView, this); 9: } 10:   11: // Just execute normally without applying Chromed View Engine 12: return base.FindView(controllerContext, viewName, masterName, useCache); 13: } If the view engine finds the [Chromed] attribute, it will invoke it’s own process – otherwise, it’ll just defer to the normal web forms view engine (with masterpages). The ChromeView’s primary job is to independently set the BodyContent on the view context so that it can be rendered at the appropriate place: 1: public class ChromeView : IView 2: { 3: private ViewEngineResult bodyView; 4: private ViewEngineResult documentView; 5:   6: public ChromeView(ViewEngineResult bodyView, ViewEngineResult documentView) 7: { 8: this.bodyView = bodyView; 9: this.documentView = documentView; 10: } 11:   12: public void Render(ViewContext viewContext, System.IO.TextWriter writer) 13: { 14: ChromeViewContext chromeViewContext = ChromeViewContext.From(viewContext); 15:   16: // First render the Body view to the BodyContent 17: using (var bodyViewWriter = new StringWriter()) 18: { 19: var bodyViewContext = new ViewContext(viewContext, bodyView.View, viewContext.ViewData, viewContext.TempData, bodyViewWriter); 20: this.bodyView.View.Render(bodyViewContext, bodyViewWriter); 21: chromeViewContext.BodyContent = bodyViewWriter.ToString(); 22: } 23: // Now render the Document view 24: this.documentView.View.Render(viewContext, writer); 25: } 26: } The ChromeViewContext (code excluded here) mainly just has a string property for the “BodyContent” – but it also makes sure to put itself in the HttpContext so it’s available. Finally, we created a little extension method so the module’s view can be rendered in the appropriate place: 1: public static void RenderBody(this HtmlHelper htmlHelper) 2: { 3: ChromeViewContext chromeViewContext = ChromeViewContext.From(htmlHelper.ViewContext); 4: htmlHelper.ViewContext.Writer.Write(chromeViewContext.BodyContent); 5: } At this point, the other thing left is to decide how we want to implement the Chrome.aspx page. One approach is the copy/paste the HTML from the typical Site.Master and change the main content placeholder to use the HTML helper above – this way, there are no MasterPages anywhere. Alternatively, we could even have Chrome.aspx utilize the MasterPage if we wanted (e.g., in the case where some pages are Chromed and some pages want to use traditional MasterPage): 1: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> 2: <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> 3: <% Html.RenderBody(); %> 4: </asp:Content> At this point, it’s all academic. I can create a controller like this: 1: [Chromed] 2: public class WidgetController : Controller 3: { 4: public ActionResult Index() 5: { 6: return View(); 7: } 8: } Then I’ll just create Index.ascx (a partial view) and put in the text “Inside my widget”. Now when I run the app, I can request the full route (notice the controller name of “widget” in the address bar below) and the HTML from my Index.ascx will just appear where it is supposed to.   This means no more warnings for missing MasterPages and no more need for your module to have knowledge of the host’s MasterPage placeholders. You have the option of using the Chrome.aspx in the host or providing your own while embedding it as an embedded resource itself. I’m curious to know what people think of this approach. The code above was done with my own local copy of MvcContrib so it’s not currently something you can download. At this point, these are just my initial thoughts – just incorporating some ideas for Orchard into non-Orchard apps to enable building modular/composite apps more easily. Additionally, on the flip side, I still believe that Portable Areas have potential as the module packaging story for Orchard itself.   What do you think?

    Read the article

  • AJAX binds jquery events multiple times

    - by Dynde
    Hi... I have a masterpage setup, with a pageLoad in the topmost masterpage, which calls pageLoad2 for nested masterpages which calls pageLoad3 for content pages. In my content page I have a jquery click event and in my nested masterpage I have a web user control. Whenever I use the user control in the nested masterpage, it rebinds the click event in the content page (undoubtedly because the pageLoad3 is called again), but this makes the click event fire twice on a single click. The problem gets worse the higher up masterpages you go (eg. fires 3 times if user control from topmost masterpage is called). Can anyone tell me how to make sure it only binds the jquery events once?

    Read the article

  • "partial views" best practices for 'container' divs?

    - by ropstah
    What is the 'best' way to handle the html markup for partial views? (which are also refreshed using AJAX) The biggest issue I run into is where to place the 'container' div... Consider having a masterpage and a partial view. (class="" could be interchanged with id="" depending if the partial is guaranteed to be unique, however this isn't really important to the issue i think) Masterpage: <div id="place1" class="placeholder"> <!-- render partial --> </div> Partial: <div id="partial1" class="partial"> <!-- content --> </div> I feel that something isn't being done right. However I cannot remove the div in the masterpage, because I need that to 'encapsulate' the response from AJAX partial updates. And also I cannot move the div in the partial to the masterpage, because that would require to move 'partial' info to the masterpage... How do you handle this?

    Read the article

  • 1 ASPX Page, Multiple Master Pages

    - by csmith18119
    So recently I had an ASPX page that could be visited by two different user types.  User type A would use Master Page 1 and user type B would use Master Page 2.  So I put together a proof of concept to see if it was possible to change the MasterPage in code.  I found a great article on the Microsoft ASP.net website. Specifying the Master Page Programmatically (C#) by Scott Mitchell So I created a MasterPage call Alternate.Master to act as a generic place holder.  I also created a Master1.Master and a Master2.Master.  The ASPX page, Default.aspx will use this MasterPage.  It will also use the Page_PreInit event to programmatically set the MasterPage.  1: protected void Page_PreInit(object sender, EventArgs e) { 2: var useMasterPage = Request.QueryString["use"]; 3: if (useMasterPage == "1") 4: MasterPageFile = "~/Master1.Master"; 5: else if (useMasterPage == "2") 6: MasterPageFile = "~/Master2.Master"; 7: }   In my Default.aspx page I have the following links in the markup: 1: <p> 2: <asp:HyperLink runat="server" ID="cmdMaster1" NavigateUrl="~/Default.aspx?use=1" Text="Use Master Page 1" /> 3: </p> 4: <p> 5: <asp:HyperLink runat="server" ID="cmdMaster2" NavigateUrl="~/Default.aspx?use=2" Text="Use Master Page 2" /> 6: </p> So the basic idea is when a user clicks the HyperLink to use Master Page 1, the default.aspx.cs code behind will set the property MasterPageFile to use Master1.Master.  The same goes with the link to use Master Page 2.  It worked like a charm!  To see the actual code, feel free to download a copy here: Project Name: Skyhook.MultipleMasterPagesWeb http://skyhookprojectviewer.codeplex.com

    Read the article

  • Codeigniter benchmarking, where are these ms coming from?

    - by ropstah
    I'm in the process of benchmarking my website. class Home extends Controller { function Home() { parent::Controller(); $this->benchmark->mark('Constructor_start'); $this->output->enable_profiler(TRUE); $this->load->library ('MasterPage'); $this->benchmark->mark('Constructor_end'); } function index() { $this->benchmark->mark('Index_start'); $this->masterpage->setMasterPage('master/home'); $this->masterpage->addContent('home/index', 'page'); $this->masterpage->show(); $this->benchmark->mark('Index_start'); } } These are the results: Loading Time Base Classes: 0.0076 Constructor: 0.0007 Index: 0.0440 Controller Execution Time ( Home/ Index ): 0.4467 Total Execution Time: 0.4545` I understand the following: Loading Time Base Classes (0.0076) Constructor (0.0007) Index (0.0440) But where is the rest of the time coming from?

    Read the article

  • Using jquery with nested masterpages

    - by diver-d
    Hi everyone, Can anyone show me how to use jquery in an asp.net nested masterpage. I have my main masterpage where I have added the link to the jquery libaray and also the validation framework. I have then created another masterpage with some styling and created a aspx page based on that masterpage. How can I attach the validation framework to textboxes within my page? I have tried $("#aspnetForm").validate({ rules: { <%=txtPostCode.UniqueID %>: { minlength: 2, required: true }, <%=txtContactEmail.UniqueID %>: { required: true, email:true } }, messages: { <%=txtPostCode.UniqueID %>:{ required: "* Required Field *", minlength: "* Please enter atleast 2 characters *" } } }); However nothing happens. Can anyone point me in the right direction?

    Read the article

  • SharePoint 2010 Hosting :: How to Customize SharePoint 2010 Global Navigation

    - by mbridge
    Requirements - SharePoint Foundation or SharePoint Server 2010 site - SharePoint Designer 2010 Steps 1. The first step in my process was to download from codeplex a starter masterpage http://startermasterpages.codeplex.com/ . 2. Once you downloaded the starter master page, open up your SharePoint site in SharePoint Designer 2010 and on the left in the “Site Objects “ area click on the folder “All Files” and drill down to catalogs >> masterpages . Once you are in the Masterpage folder copy and paste the _starter.master into this folder. 3. The first step in the customization process is to create your custom style sheet. To create your custom style sheet, click on the “all Files” folder and click on “Style Library.” Right click in the style library section and choose Style sheet. Once the style sheet is created, rename it style.css. Now open the style sheet you created in SharePoint Designer. 4. In this next step you will copy and paste the SharePoint core styles for the global navigation into your custom style sheet. Copy and paste the css below into the style sheet and save file .s4-tn{ padding:0px; margin:0px; } .s4-tn ul.static{ white-space:nowrap; } .s4-tn li.static > .menu-item{ /* [ReplaceColor(themeColor:"Dark2")] */ color:#3b4f65; white-space:nowrap; border:1px solid transparent; padding:4px 10px; display:inline-block; height:15px; vertical-align:middle; } .s4-tn ul.dynamic{ /* [ReplaceColor(themeColor:"Light2")] */ background-color:white; /* [ReplaceColor(themeColor:"Dark2-Lighter")] */ border:1px solid #D9D9D9; } .s4-tn li.dynamic > .menu-item{ display:block; padding:3px 10px; white-space:nowrap; font-weight:normal; } .s4-tn li.dynamic > a:hover{ font-weight:normal; /* [ReplaceColor(themeColor:"Light2-Lighter")] */ background-color:#D9D9D9; } .s4-tn li.static > a:hover { /* [ReplaceColor(themeColor:"Accent1")] */ color:#44aff6; text-decoration:underline; } 5. Once you created the style sheet, go back to the masterpage folder and open the _starter.master file and in the Customization category click edit file. 6. Next, when the edit file opens make sure you view it in split view. Now you are going to search for the reference to our custom masterpage in the code. Make sure you are scrolled to the top in the code section and press “ctrl f” on the key board. This will pop up the find and replace tool. In the” find what field”, copy and paste and then click find next. 7. Now, in the code replace You have now referenced your custom style sheet in your masterpage. 8. The next step is to locate your Global Navigation control, make sure you are scrolled to the top in the code section and press “ctrl f” on the key board. This will pop up the find and replace tool. In the” find what field”, copy and paste ID="TopNavigationMenuV4” and then click find next. Once you find ID="TopNavigationMenuV4” , you should see the following block of code which is the global navigation control: ID="TopNavigationMenuV4" Runat="server" EnableViewState="false" DataSourceID="topSiteMap" AccessKey="" UseSimpleRendering="true" UseSeparateCss="false" Orientation="Horizontal" StaticDisplayLevels="1" MaximumDynamicDisplayLevels="1" SkipLinkText="" CssClass="s4-tn" 9. In the global navigation code above you should see CssClass="s4-tn" . As an additional step you can replace "s4-tn" your own custom name like CssClass="MyNav" . If you can the name of the CSS class make sure you update your custom style sheet with the new name, example below: .MyNav{ padding:0px; margin:0px; } .MyNav ul.static{ white-space:nowrap; } 10. At this point you are ready to brand your global navigation. The next step is to modify your style.css with your customizations to the default SharePoint styles. Have fun styling and make sure you save your work often. Hope it helps!!

    Read the article

  • Running ASP.NET Webforms and ASP.NET MVC side by side

    - by rajbk
    One of the nice things about ASP.NET MVC and its older brother ASP.NET WebForms is that they are both built on top of the ASP.NET runtime environment. The advantage of this is that, you can still run them side by side even though MVC and WebForms are different frameworks. Another point to note is that with the release of the ASP.NET routing in .NET 3.5 SP1, we are able to create SEO friendly URLs that do not map to specific files on disk. The routing is part of the core runtime environment and therefore can be used by both WebForms and MVC. To run both frameworks side by side, we could easily create a separate folder in your MVC project for all our WebForm files and be good to go. What this post shows you instead, is how to have an MVC application with WebForm pages  that both use a common master page and common routing for SEO friendly URLs.  A sample project that shows WebForms and MVC running side by side is attached at the bottom of this post. So why would we want to run WebForms and MVC in the same project?  WebForms come with a lot of nice server controls that provide a lot of functionality. One example is the ReportViewer control. Using this control and client report definition files (RDLC), we can create rich interactive reports (with charting controls). I show you how to use the ReportViewer control in a WebForm project here :  Creating an ASP.NET report using Visual Studio 2010. We can create even more advanced reports by using SQL reporting services that can also be rendered by the ReportViewer control. Now, consider the sample MVC application I blogged about called ASP.NET MVC Paging/Sorting/Filtering using the MVCContrib Grid and Pager. Assume you were given the requirement to add a UI to the MVC application where users could interact with a report and be given the option to export the report to Excel, PDF or Word. How do you go about doing it?   This is a perfect scenario to use the ReportViewer control and RDLCs. As you saw in the post on creating the ASP.NET report, the ReportViewer control is a Web Control and is designed to be run in a WebForm project with dependencies on, amongst others, a ScriptManager control and the beloved Viewstate.  Since MVC and WebForm both run under the same runtime, the easiest thing to is to add the WebForm application files (index.aspx, rdlc, related class files) into our MVC project. You can copy the files over from the WebForm project into the MVC project. Create a new folder in our MVC application called CommonReports. Add the index.aspx and rdlc file from the Webform project   Right click on the Index.aspx file and convert it to a web application. This will add the index.aspx.designer.cs file (this step is not required if you are manually adding a WebForm aspx file into the MVC project).    Verify that all the type names for the ObjectDataSources in code behind to point to the correct ProductRepository and fix any compiler errors. Right click on Index.aspx and select “View in browser”. You should see a screen like the one below:   There are two issues with our page. It does not use our site master page and the URL is not SEO friendly. Common Master Page The easiest way to use master pages with both MVC and WebForm pages is to have a common master page that each inherits from as shown below. The reason for this is most WebForm controls require them to be inside a Form control and require ControlState or ViewState. ViewMasterPages used in MVC, on the other hand, are designed to be used with content pages that derive from ViewPage with Viewstate turned off. By having a separate master page for MVC and WebForm that inherit from the Root master page,, we can set properties that are specific to each. For example, in the Webform master, we can turn on ViewState, add a form tag etc. Another point worth noting is that if you set a WebForm page to use a MVC site master page, you may run into errors like the following: A ViewMasterPage can be used only with content pages that derive from ViewPage or ViewPage<TViewItem> or Control 'MainContent_MyButton' of type 'Button' must be placed inside a form tag with runat=server. Since the ViewMasterPage inherits from MasterPage as seen below, we make our Root.master inherit from MasterPage, MVC.master inherit from ViewMasterPage and Webform.master inherits from MasterPage. We define the attributes on the master pages like so: Root.master <%@ Master Inherits="System.Web.UI.MasterPage"  … %> MVC.master <%@ Master MasterPageFile="~/Views/Shared/Root.Master" Inherits="System.Web.Mvc.ViewMasterPage" … %> WebForm.master <%@ Master MasterPageFile="~/Views/Shared/Root.Master" Inherits="NorthwindSales.Views.Shared.Webform" %> Code behind: public partial class Webform : System.Web.UI.MasterPage {} We make changes to our reports aspx file to use the Webform.master. See the source of the master pages in the sample project for a better understanding of how they are connected. SEO friendly links We want to create SEO friendly links that point to our report. A request to /Reports/Products should render the report located in ~/CommonReports/Products.aspx. Simillarly to support future reports, a request to /Reports/Sales should render a report in ~/CommonReports/Sales.aspx. Lets start by renaming our index.aspx file to Products.aspx to be consistent with our routing criteria above. As mentioned earlier, since routing is part of the core runtime environment, we ca easily create a custom route for our reports by adding an entry in Global.asax. public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}");   //Custom route for reports routes.MapPageRoute( "ReportRoute", // Route name "Reports/{reportname}", // URL "~/CommonReports/{reportname}.aspx" // File );     routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); } With our custom route in place, a request to Reports/Employees will render the page at ~/CommonReports/Employees.aspx. We make this custom route the first entry since the routing system walks the table from top to bottom, and the first route to match wins. Note that it is highly recommended that you write unit tests for your routes to ensure that the mappings you defined are correct. Common Menu Structure The master page in our original MVC project had a menu structure like so: <ul id="menu"> <li> <%=Html.ActionLink("Home", "Index", "Home") %></li> <li> <%=Html.ActionLink("Products", "Index", "Products") %></li> <li> <%=Html.ActionLink("Help", "Help", "Home") %></li> </ul> We want this menu structure to be common to all pages/views and hence should reside in Root.master. Unfortunately the Html.ActionLink helpers will not work since Root.master inherits from MasterPage which does not have the helper methods available. The quickest way to resolve this issue is to use RouteUrl expressions. Using  RouteUrl expressions, we can programmatically generate URLs that are based on route definitions. By specifying parameter values and a route name if required, we get back a URL string that corresponds to a matching route. We move our menu structure to Root.master and change it to use RouteUrl expressions: <ul id="menu"> <li> <asp:HyperLink ID="hypHome" runat="server" NavigateUrl="<%$RouteUrl:routename=default,controller=home,action=index%>">Home</asp:HyperLink></li> <li> <asp:HyperLink ID="hypProducts" runat="server" NavigateUrl="<%$RouteUrl:routename=default,controller=products,action=index%>">Products</asp:HyperLink></li> <li> <asp:HyperLink ID="hypReport" runat="server" NavigateUrl="<%$RouteUrl:routename=ReportRoute,reportname=products%>">Product Report</asp:HyperLink></li> <li> <asp:HyperLink ID="hypHelp" runat="server" NavigateUrl="<%$RouteUrl:routename=default,controller=home,action=help%>">Help</asp:HyperLink></li> </ul> We are done adding the common navigation to our application. The application now uses a common theme, routing and navigation structure. Conclusion We have seen how to do the following through this post Add a WebForm page from a WebForm project to an existing ASP.NET MVC application Use a common master page for both WebForm and MVC pages Use routing for SEO friendly links Use a common menu structure for both WebForm and MVC. The sample project is attached below. Version: VS 2010 RTM Remember to change your connection string to point to your Northwind database NorthwindSalesMVCWebform.zip

    Read the article

  • How to get a safecontrol entry into manifest.xml with WSPBuilder project

    - by andrew
    Upon taking the default sharepoint master page for MySite, making some changes, and making a wsp out of it with WSPBuilder, I come to these errors in my logs: http://spoint/MySite/%5Fcatalogs/masterpage/MySite.master - An unexpected error has been encountered in this Web Part. Error: The control with virtual path '_controltemplates/Welcome.ascx' is not in the safe controls list for web at URL 'http://spoint/MySite'., Source: [UnsafeControlException: The control with virtual path '_controltemplates/Welcome.ascx' is not in the safe controls list for web at URL 'http://spoint/MySite' (stack trace omitted) http://spoint/MySite/%5Fcatalogs/masterpage/MySite.master - An unexpected error has been encountered in this Web Part. Error: The control with virtual path '_controltemplates/DesignModeConsole.ascx' is not in the safe controls list for web at URL 'http://spoint/MySite'., Source: [UnsafeControlException: The control with virtual path '_controltemplates/DesignModeConsole.ascx' is not in the safe controls list for web at URL 'http://spoint/MySite' (stack trace ommited) So, this masterpage does in fact use these OOTB controls and so I guess I need to get them safecontrolled. And I guess I want to do this via the manifest.xml. But I do not see how to make WSPBuilder do this.

    Read the article

  • New to C# and trying to use a global variable

    - by Andrew G. Johnson
    Is it possible to use global variables in C#? I'm coming from mainly a PHP background so variables are either accessible everywhere or just a global definition away. My main issue is I have a User class that I built myself to wrap around the current users table on my company's database. I am defining it in the MasterPage but can't seem to access it from the actual pages (I don't know if there's a better word to describe them but they are the pages that inherit the styles and format from the MasterPage) Any general tips or implementation practices for me? EDIT: here's some code snippets of what I'm trying to do: Site.master.cs public partial class SiteMaster : System.Web.UI.MasterPage { public User user = new User(); } logout.aspx <%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="logout.aspx.cs" Inherits="logout" %> <%@ MasterType virtualPath="~/Site.master"%> logout.aspx.cs public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { User user = Master.user; } }

    Read the article

  • How do you set page level, page-SPECIFIC javascript events using a ContentPlaceHolder?

    - by donde
    I previously asked how to include Javascript in my page when I split the page into a MasterPage and ContentPlaceHolder (.NET 2.0 app) The issue was I only wanted the javascript functions on THAT page so I couldn't just put them on the masterpage. Based on the answers, I will inlcude common fucntions through MasterPage and can put the page-specific function right on the content page. However, 1 question remains: Events. I have 2 Javascript functions that I wanted to load when the page loads ala the HTML below. How do you load javascript page events on the specific content page? Or in the case below, the OnKeyPress event? <body onkeypress="javascript:keypressed();" onload="javascript:setDivVisibility();">

    Read the article

  • Master Page: Dynamically Adding Rows in ASP Table on Button Click event

    - by Vincent Maverick Durano
    In my previous post here, I wrote an example that demonstrates how are we going to generate table rows dynamically using ASP Table on click of the Button control. Now based on some comments in my previous example and in the forums they wanted to implement it within Masterpage. Unfortunately the code in my previous example doesn't work in Masterpage for the following main reasons: The Table is dynamically added within the Form tag and so the TextBox control will not be generated correcty in the page. The data will not be retained on each and every postbacks because the SetPreviousData() method is looking for the Table element within the Page and not on the MasterPage. The Request.Form key value should be set correctly since all controls within the master page are prefixed with the naming containter ID to prevent duplicate ids on the final rendered HTML. For example the TextBox control with the ID of TextBoxRow will turn to ID to this ctl00$MainBody$TextBoxRow. In order for the previous example to work within Masterpage then we will have to correct those three main reasons above and this post will guide you how to correct it. Suppose we have this content page declaration below:   <asp:Content ID="Content1" ContentPlaceHolderID="MainHead" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainBody" Runat="Server"> <asp:PlaceHolder ID="PlaceHolder1" runat="server"> <asp:Button ID="BTNAdd" runat="server" Text="Add New Row" OnClick="BTNAdd_Click" /> </asp:PlaceHolder> </asp:Content> As you notice I've added a PlaceHolder control within the MainBody ContentPlaceHolder. This is because we are going to generate the Table in the PlaceHolder instead of generating it within the Form element. Now since issue #1 is already corrected then let's proceed to the code beind part. Here are the full code blocks below:     using System; using System.Web.UI; using System.Web.UI.WebControls; public partial class DynamicControlDemo : System.Web.UI.Page { private int numOfRows = 1; protected void Page_Load(object sender, EventArgs e) { //Generate the Rows on Initial Load if (!Page.IsPostBack) { GenerateTable(numOfRows); } } protected void BTNAdd_Click(object sender, EventArgs e) { if (ViewState["RowsCount"] != null) { numOfRows = Convert.ToInt32(ViewState["RowsCount"].ToString()); GenerateTable(numOfRows); } } private void SetPreviousData(int rowsCount, int colsCount) { Table table = (Table)this.Page.Master.FindControl("MainBody").FindControl("Table1"); // **** if (table != null) { for (int i = 0; i < rowsCount; i++) { for (int j = 0; j < colsCount; j++) { //Extracting the Dynamic Controls from the Table TextBox tb = (TextBox)table.Rows[i].Cells[j].FindControl("TextBoxRow_" + i + "Col_" + j); //Use Request object for getting the previous data of the dynamic textbox tb.Text = Request.Form["ctl00$MainBody$TextBoxRow_" + i + "Col_" + j];//***** } } } } private void GenerateTable(int rowsCount) { //Creat the Table and Add it to the Page Table table = new Table(); table.ID = "Table1"; PlaceHolder1.Controls.Add(table);//****** //The number of Columns to be generated const int colsCount = 3;//You can changed the value of 3 based on you requirements // Now iterate through the table and add your controls for (int i = 0; i < rowsCount; i++) { TableRow row = new TableRow(); for (int j = 0; j < colsCount; j++) { TableCell cell = new TableCell(); TextBox tb = new TextBox(); // Set a unique ID for each TextBox added tb.ID = "TextBoxRow_" + i + "Col_" + j; // Add the control to the TableCell cell.Controls.Add(tb); // Add the TableCell to the TableRow row.Cells.Add(cell); } // And finally, add the TableRow to the Table table.Rows.Add(row); } //Set Previous Data on PostBacks SetPreviousData(rowsCount, colsCount); //Sore the current Rows Count in ViewState rowsCount++; ViewState["RowsCount"] = rowsCount; } }   As you observed the code is pretty much similar to the previous example except for the highlighted lines above. That's it! I hope someone find this post usefu! Technorati Tags: Dynamic Controls,ASP.NET,C#,Master Page

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >