Web Forms :: Creating Web Application Using Master Page Project?
Aug 17, 2010
looking for information on how to do this. our company has one website, with several different applications. the way we have set it up is that we have been creating these different applications as websites, we have one Master page for the whole site, so when we create a new website we also create a virtual site with our master page in it. We are using VS 2008 now and what we want to do is make the change to creating web applications but I have not been able to figure out how to bring our master pages into the application, without bringing the actual pages into the app. the only thing I have been finding is people creating the master page file in the web application, that will not work for us, as we have to many applications and if there is a change in the master page it has to show on our whole website, so we need to either be able to bring our master page in as another project or set it up as a virtual directory, or reference it in the web.cofig somehow, but the master page needs to stay in it's own directory and only referenced.
How would I go about creating a desktop application that would be capable of generating an ASP.NET master page, perhaps using drag and drop for the different allowed elements (image, text, video). I would take the co-ordinates and generate a master page that can be used later.
i want to do a white labeling for the product i built.. so i know the skins and theams and also i made diffrent masterpage with deffrent design and css file...... and i will change master page file name at page preeint evenet on each page,,,,, but i need is that i want to do master page on fly. i mean that i want to create master template on fly as for the clients color selection..
I am searching the internet for possible solution for my problem, I have a page that sets the master page at runtime, my problem is how to create a content (asp:Content) control for each of contentplaceholder (that exists at design-time) in each masterpage?? I am looking at AddContentTemplate, but seems not working...
For those who setup muli project areas in ASP.NET MVC 2 in VS 2010, I have a few questions for you:
Can other project areas use one master page? Or does each have to have their own master page? What about the web.config file? Does each area need the config file? Or does it rely on the master? I tried removing the master page reference, but I get an intellisense error and failed to monitor changes after following this: [URL]
I assume I need to leave in the master page so that at least works.
Is it possible to inherit a sharepoint master page(as a parent) in another application's master page which will be treated as child (i.e. after integrating that standalone application with the sharepoint application)? I am totally new to Sharepoint..
We have two projects. One is in MVC and the other is the traditional Asp.Net project. We are trying to share a common Master Page for both the projects. The Master page for the MVC project is already using a form tag with runat="server" attribute because it's using a traditional ASP.Net control for the navigation menu. The ContentPlaceHolder is outside this form.
UPDATE: Found the answer here: [URL] <form id="Form1" runat="server"> ....... <asp:ContentPlaceHolder ID="MainContent" runat="server" /> </form>
I am trying to add a .aspx page in the project , but while adding the .aspx page i am not getting the option to choose existing master pages. I remember long back i used to get that option to select the master page.
I am re-vamping an existing website and have several "Sub" directories. I need to have my navigation (not using the .net navigation/sitmenu) but I need my mnus to point to the absolute root of my site in order to go between menu item pages. In other words, my menu is structured like this:
As you can see, the only two pages that are in the Root part of my Project are the Default.aspx page and the Contact.aspx page. This wokrs fine if I am just going to the Home (default) page or the Contact Us page, but of course if I go to the Rose Garden or the Articles pages and then try to go "Home" the page isn't found. I know that using "Absoluteroot" should work to get me back to the root section of my menu, but the only place I have used this is in the BlogEngine. Can anyone plaese point me to a tutiral on how to do this within my own web project?
I trying to run my project and I get the following error 'lstpreferredtheme_selectedindexchanged is not a member of ASP.Masterpages_Masterpage_master Even I've named the id of my dropdown list lstpreferredtheme which I trying to call. My code is below
<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %> <!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"> <title>Untitled Page</title> <asp:ContentPlaceHolder ID="head" runat="server"> </asp:ContentPlaceHolder> </head> <body> <form id="form1" runat="server"> <div id="PageWrapper"> <div id="Header"> <a href="~/" runat="server">Header Goes Here</a></div> <div id="MenuWrapper"> Menu Goes Here</div> <div id="MainContent"> <asp:ContentPlaceHolder ID="cpMainContent" runat="server"> </asp:ContentPlaceHolder> </div> <div id="Sidebar" title="Select A Theme"> <p>Select A Theme</p> <asp:DropDownList runat="server" AutoPostBack="True" Height="16px" Width="101px" onselectedindexchanged="lstPreferredTheme_SelectedIndexChanged" ID="lstPreferredTheme" DataTextField="Select A Theme"> <asp:ListItem>Monochrome</asp:ListItem> <asp:ListItem>Dark Grey</asp:ListItem> </asp:DropDownList> </div> <div id="Footer"> Footer Goes Here</div> </div> </form> </body> </html> Masterpage vb code Partial Class MasterPage Inherits System.Web.UI.MasterPage Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstPreferredTheme.SelectedIndexChanged Dim preferredTheme As HttpCookie = New HttpCookie("PreferredTheme") preferredTheme.Expires = DateTime.Now.AddMonths(3) preferredTheme.Value = lstPreferredTheme.SelectedValue Response.Cookies.Add(preferredTheme) Response.Redirect(Request.Url.ToString()) End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then Dim selectedTheme As String = Page.Theme Dim preferredTheme As HttpCookie = Request.Cookies.Get("PreferredTheme") If preferredTheme IsNot Nothing Then selectedTheme = preferredTheme.Value End If If lstPreferredTheme.Items.FindByValue(selectedTheme) IsNot Nothing Then lstPreferredTheme.Items.FindByValue(selectedTheme).Selected = True End If End If End Sub End Class
I have Web Application which uses the Logged In User (Authenticated User) to query his Profile Data from Adabas/Unix using OLEDB. The application provides the user with about 21 different pages (Basic Info, Employment Info, Education, Dependants, Financial Info ...).
The web application has a master page, and each profile data page is based on a User Control loaded in the Child ASPX Page.
The Data Layer of this Web Application will have to undergo major modification, since we are migrating our legacy applications from Adabas/Unix to SAP, the development Team has prepared web services to query for the same Profile Data from SAP using Web Services. Now, we have to modify the web application to consume the web services instead of using OLEDB to query Adabas.
Since we are in the testing phase, and we have only very limited data in SAP, I have to provide temporary control to allow test query the Staff Profile for a Specified User (instead of the Authenticated User) and to select the Source:
1. SAP, or
So I am thinking to add the following "Control Section" in the Master Page:
See image below to clarify:
Becuase the users defined in SAP are based on Dummy Data, so we want to allow the user to Enter the required SAP User, and he will select "SAP" from the Drop-Down-List. In this case, the program will query for Staff Profile Data from SAP for the specified "Staff ID" (txtSAPStaffID) instead of the Authenticated User. But, if "Adabas" is selected for the "ddlDataSource" then, it will default to the Authenticated User.
I noticed that when I am following the above technique, if I press "Go", the Staff Profile Data Page is disappeared, and when I navigate from page to another, the selection on the values entered in the "Control Section" in the master page are reset to default value, ie, the last values are not maintained.
1. What is your feedback on the method I followed above ? Any other recommendations? I need very simple method.
2. Why the data page (the child page of the master page) is cleared (disappears) when I press the Go button ?
3. How to maintain the values selected when I navigate from one page to another ?
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.
I am using a Report Viewer Page in a Asp Project, As my query is big i have Somany columns to be included in the Report viewer. But i am in a position that i cant increase the Page size of the Report to be Correctly fix the Entire Columns in the Report.
I'm prototyping an environment where multiple applications run on the same server, but they all share a master page. Is it possible to load a master page from another application? In one of my applications, I have this code:
What this does is set the master page to a file sitting outside my current application. (Note the ".." after the tilde -- so I'm going to the root of my current app, then stepping up a directory to find a master page.)
ASP is displeased with this:
The virtual path '/MasterPages/Root.master' maps to another application, which is not allowed. I understand that it might be stressed out about the fact that there's no backing class for it, but what if I have nothing in the code-behind, and I choose not to inherit my master page from anything -- so the entire thing is contained in the ".master" file?Is there any way to do this?
how can i add title and meta tags for content pages in a project base on master and content page(dinamically) ?
i used the blow method for master page :
and the error is :(in line *)
Error 17 'System.Web.UI.MasterPage' does not contain a definition for 'SetMetaTags' and no extension method 'SetMetaTags' accepting a first argument of type 'System.Web.UI.MasterPage' could be found (are you missing a using directive or an assembly reference?)
I'm trying create unit testing for an existing website project (not web application project). I cannot access my under test classes unless I use accessor. However, if I use accessor, I have problem to initiate an object with passing arguments. I only want to create unit tetsing for App_Code. After searching web, and I found that I'd better to create a web application project using my current existing website project. From solution explorer, add new project ->using existing website. My questions is: what impact will have for my current website to create the new project? Should I just convert my current website to web application? If do that, will it cuase problems on my website? I am new on asp.net, still learning..
I just converted an ASP.NET Web Site Project to a Web Application Project in VS 2010. After I run the application though it seems that my class polymorphism broke. I don't have a clue as to why this could occur.
So in the following code when I call base.OnLoad(e) I am getting errors in the base class because the variable myString is null. In fact all the variables for the Base class are null. I can do
I have web application workung with master page.I want to know when the user is closing the browser' then I'll raise event to clean' session variables.How can I detect the browser closing/I tried the unload jscript event' but it fired when I move from page to page.
I recently updated my VS2010 website project from .NET 3.5 to 4.0. Everything was working fine in the website project. Today I decided to migrate the website to a web application project as I have learned this is the best way to work in .NET. I split out all my class files into a separate class library and copied all my other content into my new project. Then I updated all the references and web.config.
When I build the class library, everything works great. The problem is happening when I try to build/debug the web application project. It is acting like all the controls are missing and it is also throwing a bunch of compile errors about the public properties I have in my master pages.
Control errors: "The name 'INSERT CONTROL NAME HERE' does not exist in the current context"
Master page errors:'System.Web.UI.MasterPage' does not contain a definition....
It is giving these errors for every single control and master page property in my entire solution.I notice when I add a new web.form to this project, it also adds a filename.aspx.designer.cs file in addition to the .aspx and .aspx.cs file. My existing files do not have these extra files since they were created in a different .NET version.
UPDATE: It seems I was missing the step where I need to right click on the new application folder and select "Convert to web application". I just did that and it seems to be a little bit better...
Now it is choking on Literals that are inside single quotes: