master-pages

“maintainScrollPositionOnPostBack=”true“ ” does not work with google chrome

我怕爱的太早我们不能终老 提交于 2019-11-29 10:27:28
Web.config Level => pages maintainScrollPositionOnPostBack="true" /> Page Level => <%@ Page MaintainScrollPositionOnPostback="true" %> Code Level => Page.MaintainScrollPositionOnPostBack = true; Browser Level => browser id="Chrome" parentID="Safari1Plus"> capabilities> capability name="supportsMaintainScrollPositionOnPostback" value="true" /> capabilities> browser> Any of the 4 ways mentioned above did not work with google chrome . It is working fine with firefox. Kindly provide any solution . You can add this snippet to your ASP.NET Page/MasterPage (jQuery required): <asp:HiddenField runat=

ASP.NET masterpages: how to insert markup in the head section inside the aspx?

心已入冬 提交于 2019-11-29 10:23:05
I know I can access the head section of a page which uses a masterpage programmatically this way (in code behind): This is only an example (I'd like to insert scripts and styles etc.): this.Header.Title = "I just set the page's title"; Is there a simple way to do this in a declarative way on in the aspx file itself ? Sometimes it would be handy to insert a client script or a style declaration or a link to an external resource. You can do this by using content regions in the head , in exactly the same way as you would in the body of the page. eg, In your masterpage: <head> <link type="text/css"

Dynamically changing Master Template in ASP.NET MVC

余生颓废 提交于 2019-11-29 09:53:39
问题 I have the requirement to support different Master pages on my application (ASP.NET MVC). What is the recommended way to: Pass the master page name to the view from. Store the master page (in session, or something) so it sticks during a user's visit. 回答1: Use a custom base controller and inherit from it instead: Public Class CustomBaseController Inherits System.Web.Mvc.Controller Protected Overrides Function View(ByVal viewName As String, ByVal masterName As String, ByVal model As Object) As

How to set the default button in content page using asp.net?

只愿长相守 提交于 2019-11-29 09:21:57
I need to set the content page default button. My code is like this: <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent" defaultbutton="BtnSearch" defaultfocus="TxtSearchValue"> It is working fine, but my master page menu have one image button like chat, I can press the enter key to fire image button click event but it does not fire default button in content page. How to handle this type of issue? 1) You simply have to do: this.Form.DefaultButton = this.btnId.UniqueID; OR 2) Using Javascript: function clickButton(e, buttonid) { var evt = e ? e : window.event; var bt

ResolveUrl Problem in Master Page

随声附和 提交于 2019-11-29 08:42:11
Okay, I know it is weird but when I put this code between <head runat="server"></head> in master.page, this is how it renders into: <link id="ctl00_Link1" rel="shortcut icon" href="../%3C%25%20ResolveUrl(%22~/Resources/Pictures/Shared/Misc/favicon.ico%22);%20%25%3E" type="image/x-icon" /> It doesn't see something asp.net needs to take care of. This is the original code : <link id="Link1" rel="shortcut icon" href='<%=ResolveUrl("~/Resources/Pictures/Shared/Misc/favicon.ico") %>' type="image/x-icon" runat="server" /> Basically Asp.Net doesn't take care of the code below and renders as a normal

How do I reference an ASP.net MasterPage from App_Code

你。 提交于 2019-11-29 07:50:35
I'm working on a .net 3.5 site, standard website project. I've written a custom page class in the sites App_Code folder (MyPage). I also have a master page with a property. public partial class MyMaster : System.Web.UI.MasterPage { ... private string pageID = ""; public string PageID { get { return pageID; } set { pageID = value; } } } I'm trying to reference this property from a property in MyPage. public class MyPage : System.Web.UI.Page { ... public string PageID { set { ((MyMaster)Master).PageID = value; } get { return ((MyMaster)Master).PageID; } } } I end up with "The type or namespace

How to fix namespace problem with autogenerated Master property if MasterType is set

大城市里の小女人 提交于 2019-11-29 07:30:55
after weeks of having this issue I finally decided to ask for a solution to the following problem: In the .aspx page you can set <%@ MasterType VirtualPath="~/Mastername.master" %> This results in an auto generated property in the .aspx.designer public new Mastername Master { get { return ((Masternamee)(base.Master)); } } Works perfectly fine. But if I do changes in the .aspx file, the property will be new auto generated and it looks like the following: public new NAMESPACE1.Mastername Master { get { return ((NAMESPACE1.Mastername)(base.Master)); } } Compiling will not be possible afterwards,

Find a UnorderedList <UL> control inside a master page from a content page in asp.net

大城市里の小女人 提交于 2019-11-29 07:16:34
Hai guys, I want to find a UL control and then find a LI within that UL and assign a css class to that from a content page.... <ul id="mainMenu" runat="server" style="width:350px;"> <li id="mainHome" runat="server"><a title="Home" href="#" class="home">Home</a></li> <li id="mainManage" runat="server"><a title="Manage" href="#" class="manage">Manage</a></li> <li id="mainEnquiry" runat="server"><a title="Enquiry" href="#" class="enquiry">Enquiry</a></li> <li id="mainReport" runat="server"><a title="Report" href="#" class="report">Reports</a></li> </ul> If the user clicks home it is redirected to

why we use @Master type?

笑着哭i 提交于 2019-11-29 03:33:07
if we have a master page and a content page.so the content page @Page directive look like as <%@ Page Language="C#" MasterPageFile="~/Site1.Master" .... /> so , in order to access master page controls in content page we should have to use <%@ MasterType VirtualPath="~/Site1.Master" %> so , my question is this why we use @MasterType directive when we already define in the @page directive that this content page is in the master page (here -- Site1.Master) Lloyd From Microsoft Docs you are defining the type of the Master property, which allows you to access the properties of your MasterPage

Changing the generated ASP.Net <form> id?

好久不见. 提交于 2019-11-28 23:52:33
In my ASP.Net page I have <form id="MasterPageForm" runat="server"> However, whenever the markup is generated, it turns into <form name="aspnetForm" method="post" action="SomePage.aspx..." id="aspnetForm"> Is it possible to set what the generated HTML id for the form is? Carter Medlin Note: you are seeing "aspnetForm" because you are using a master page. I found your solution in this thread... http://forums.asp.net/p/883974/929349.aspx In short, this is what the answer is from that link: Here's the responsible code for that error: public override string UniqueID { get { if (this