master-pages

System.ArgumentException: An entry with the same key already exists

萝らか妹 提交于 2019-12-06 03:38:10
My masterPage, I use acordion menu <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="DefaultMaster.Master.cs" Inherits="Lab.DefaultMaster" ClientIDMode="Static" %> <%@ Import Namespace="Resources" %> <!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 runat="server"> <link type="text/css" href="css/style.css" rel="Stylesheet" /> <title> <asp:ContentPlaceHolder ID="title" runat="server"> </asp:ContentPlaceHolder> </title> <link href="css/custom-theme/jquery-ui-1.8.2

Using JQuery in a Subfolder When the MasterPage is in the Root Folder

左心房为你撑大大i 提交于 2019-12-06 02:47:25
问题 I am trying to use the jquery library in ASP.NET in a subfolder called "samples" with a masterpage that is located in the root directory. Presently the references to the jquery scripts are located in the head tag of the master page. If the page I am creating is also in the root directory, everything works fine. If I move the page to the "samples" subdirectory, the jquery breaks. I can fix the problem by using something like the following in the head tag: <script src="<%=ResolveUrl("~/js

ViewState object lost in Master Page Load

…衆ロ難τιáo~ 提交于 2019-12-06 02:30:20
问题 I am assigning ViewState["something"] in Page Load of content page and when I try to access the ViewState variable in Master Page Load event handler, the viewstate variable is lost.Can anyone guide me why this is happening and the solution. 回答1: Master pages and content pages do not share the same ViewState. If you are trying to pass something from the content page to the master page there are a couple of alternatives: - use this.Context.Items that is common to the entire site during an HTTP

winform application master form

ぐ巨炮叔叔 提交于 2019-12-06 01:55:21
I was working on an application using asp.net and C# and It made it very easy to develop using the notion of Master Pages. now I am trying to develop a windows form application and I really need to have a master page here also. is there anything such as a master form ? thank you to simulate master-pages in winform you could cretae a base form, create either a class that inherits from System.windows.Forms or simply add a new form to your project, add the common controls and then create any other form adding an "Inherited Form" select the base form created and that should work http://www.akadia

passing viewdata to asp.net mvc masterpages

青春壹個敷衍的年華 提交于 2019-12-06 01:41:34
问题 I'm trying to pass ViewData to my asp.net mvc masterpage for an mvc usercontrol that I keep on a masterpage. For example, I created a dropdownlist of names as an mvc usercontrol and I put that in my masterpage. The problem I am running into is passing the ViewData to the masterpage. I found this article from Microsoft which has a decent solution but I was wondering if there are other "better" solutions out there. The thing I don't like about the solution in the link is that I have to change

How to programmatically add stuff to contentPlaceHolder?

放肆的年华 提交于 2019-12-06 01:29:48
问题 I have a master page and all of my pages are inheriting it. For formatting, I thought to place the content that differs from one page to another in a ContentPlaceHolder. Now, how can I insert everything into that? Since I am planning to populate the ContentPlaceHolder with stuff from a database I suppose I will have to do it programmatically. How can I add controls to ContentPlace Holder? I checked other answers, but I cannot access it by its ID. Should I use multiple ContentPlaceHolders from

How do I access a DIV from javascript, if ASP.NET mangles its ID?

自古美人都是妖i 提交于 2019-12-06 00:33:06
I have a web page that contains a "div" element. On the page, there is javascript to reference the div: document.getElementById('divId') . This was working fine until another developer redesigned the page to use an ASP master page. Now, document.getElementById('divId') returns null. It appears that ASP.net prepends some characters to the names of elements within contents forms when you use a master page. How can I know what the id of the div is when the page loads? Update Allow me to give a specific example to clarify the question: My page had a div with ID divNotice . After changing my page

Best Practice for multiple asp.net web applications

左心房为你撑大大i 提交于 2019-12-06 00:05:37
Looking for the best practice when having multiple web applications within one ASP.NET "site" or "solution". I have a few options I am toying with: old faithful of putting all applications and Site master into one Solution / one web application My boss is worried about having 30 'applications' that are all under the same project in VS and every time we make a change to one have to deploy to all. So this makes us want to break out each into a separate project under the same solution. This makes us have to look into Master page solutions Master page needs to support dynamic menu structure. Is

How to access controls inside a nested master page? why does it behave differently from content pages?

天大地大妈咪最大 提交于 2019-12-05 23:51:33
问题 Is there a difference between these two scenarios: (1) Accessing a property on a master page from a regular child (2) Accessing a property on a master page from a nested master page I tried to access a textbox in the master page from a content page like this: TextBox a; a = (TextBox)Master.FindControl("ayyash"); // Master is declared in MasterType directive defaultTextbox.Text = a.Text; // defaultTextBox is a textbox control inside default.aspx it works, but then when I applied the same

ASP.Net Menu Control renders incorrectly when used on a Master Page

梦想的初衷 提交于 2019-12-05 23:19:51
I'm struggling to find a solution for a weird issue with ASP.Net Menu control, when used in conjunction with Master Pages. When the user navigates to a page - via. the menu - which inherits from the Master Page, the entire menu just expands and flashes across the screen. Collapses immediately and the page is rendered.... Causes some flickering on the screen, annoying for the users. Now, there are a few work-arounds suggested for this: - Commenting out the tag from the web.config. - giving IDs to the Master Pages in their Page_Load events. Tried'em all, dosen't seem to sort out my issue :(. I'd