master-pages

Loop through all controls on asp.net webpage

不羁的心 提交于 2019-11-26 14:38:45
问题 I need to loop through all the controls in my asp.net webpage and do something to the control. In one instance I'm making a giant string out of the page and emailing it to myself, and in another case I'm saving everything to a cookie. The problem is masterpages and items with collections of controls inside them. I want to be able to pass in a Page to the method, then have that method be generic enough to loop through all controls in the inner-most content page and work with them. I've tried

ASP.NET Custom 404 Returning 200 OK Instead of 404 Not Found

感情迁移 提交于 2019-11-26 12:04:58
问题 After trying to setup my site for Google Webmaster Tools I found that my Custom ASP.NET 404 page was not returning the 404 status code. It displayed the correct custom page and told the browser that everything is OK. This is consider a soft 404 or false 404. Google doesn\'t like this. So I found many articles on the issue but the solution I want didn\'t seem to work. The solution I want to work is adding the following two lines to the code behind Page_Load method of the custom 404 page.

MVC 3: How to render a view without its layout page when loaded via ajax?

我与影子孤独终老i 提交于 2019-11-26 11:46:46
问题 I am learning about Progressive Enhancement and I have a question about AJAXifying views. In my MVC 3 project I have a layout page, a viewstart page, and two plain views. The viewstart page is in the root of the Views folder and thus applies to all views. It specifies that all views should use _Layout.cshtml for their layout page. The layout page contains two navigation links, one for each view. The links use @Html.ActionLink() to render themselves to the page. Now I have added jQuery and

Proper way to use JQuery when using MasterPages in ASP.NET?

佐手、 提交于 2019-11-26 10:31:06
问题 I have no issues when doing using JQuery in a aspx page without a masterpage, but when I try to use it in pages that have a masterpage, it doesn\'t work, so I end up putting the jquery files and other script files in the page instead of the master. Now if I have 10 pages, I am doing this for all 10, which I know is incorrect. In the sample masterpage below, where would I put my script files. <html> <head runat=\"server\"> <asp:ContentPlaceHolder ID=\"head\" runat=\"server\"> </asp

Combine ASP.Net MVC with WebForms

青春壹個敷衍的年華 提交于 2019-11-26 04:41:22
问题 Is it possible to create a MVC root application (Portal with masterpages and themes) and add a couple of WebForms based subprojects (we already have an existing WebForms application that we would like to integrate into the Portal)? How would you centralize navigation (sitemaps, url routing)? How would you share the masterpages? How would you refer to resources (~ issues etc.)? 回答1: Combining web forms with MVC is entirely possible. See this blog post by Scott Hanselman for an introduction.

Make absolute positioned div expand parent div height

本小妞迷上赌 提交于 2019-11-26 00:59:35
问题 As you can see in the CSS below, I want child2 to position itself before child1 . This is because the site I\'m currently developing should also work on mobile devices, on which the child2 should be at the bottom, as it contains the navigation which I want below the content on the mobile devices. - Why not 2 masterpages? This is the only 2 divs which are repositioned in the entire HTML, so 2 masterpages for this minor change is an overkill. HTML: <div id=\"parent\"> <div class=\"child1\"><