Web Forms :: GetRouteUrl() Not Working On Master Page
Sep 1, 2010
I'm facing odd problem with Page.GetRouteUrl() method. It is working only on regular content pages and doesn't want to work on my master pages. I'm using simple snipet: <%# Page.GetRouteUrl("Default", null).ToString() %>, when I put it on some page, it generates "/Default", when I put it on master - I get "". I've tried calling Master.GetRouteUrl() instead but still no luck, it always returns empty
string. Funny thing is that it works in code behind (bothPage.GetRouteUrl() and MAster.GetRouteUrl() works) of the master page, only markup seems to be affected. I bet it is somehow related to the configuration since I have recently moved from ASP .NET 3.5 to 4.0 on IIS7 with integrated pipeline.
I have just added routing in a new asp.net 4 web forms application, and have got my route table set up ok and page requests are working fine. What I now want to do is use the Page.GetRouteUrl method whenever I need to generate one of my seo friendly Url's. I started to implement this across various pages then thought it might cut down on code a bit if I had a method in one of my own helper classes, that constructs this url (using the Page.GetRouteUrl method) as I might have several parameters that need to be specified against the Page.GetRouteUrl method each time.
However, within my helper class, it doesn't know what 'Page' is. I was thinking I could pass in 'Page' from the page that wants a routed url to be generated, but in some cases I want to construct one of these Url's in another class which doesn't know what 'Page' is, and in that scenario wouldn't be able to pass it in as a param (and therefore wouldn't be able to use the Page.GetRouteUrl within my helper class). What is the normal approach when wanting to use Page.GetRouteUrl within classes that don't have an instance of the Page object?
I have a page with features supplied from both a master page and a child master page.In the content placeholder for the head in both master pages I have supplied the link to the stylesheet for the site.In Design View in VS 2008 the CSS code seems to be functioning correctly.When viewing in a browser the CSS does not appear to be applied at all.
Here is the CSS code for the div elements within the main content placeholder:
I am receiving a Parser Error with all my pages in a particular folder:
Parser Error Message:
The file '/railroad/freightcars/covered_hopper/MasterFiles/Freightcars.master' does not exist. Line 1: <%@ Page Title="Freight Car Photos - CP Covered hoppers - CoveredHopperPhotos.com" Language="C#" MasterPageFile="~/MasterFiles/Freightcars.master" AutoEventWireup="true" CodeFile="cprail.aspx.cs" Inherits="railroad_freightcars_covered_hoppers_cprail" %>
It seems like the ~ is not resolving; none of my .aspx pages in this folder work. All my pages in several other folders work fine.
I had this problem with another folder when i first published pages to a folder named covered_hoppers. Since i couldn't figure out the problem, i renamed the folder to covered_hopper and re-published.. all worked fine for a couple of months until yesterday. Now i am having the same problem. No problems on my local copy; never had this error with any other folder in my site.
Im developing a website in asp.net where i want to connect the Payment gateway(rbs worldpay) as instructed im connecting to the payment gateway...the problem is, there im using some html button to connect the gate way as per the instructions the input button should be in form tag .in masterpage inherited aspx page we dont have any form tag the button is working properly when i placed that html code in content placeholder 1 but the button is displayed above the page......if i place that code in content place holder 2 the button is not working...........
I have a master page with accordion. Accordion binds link buttons inside datalist in its content template. Everything works fine but when i open this page in firefox my link buttons alongwith SignOut Link button stops working?
i have build with simple master page with a child page,it is working fine, i deployed it on iis,it is working fine,when I hosted it on server, and hit the url , only child page is coming and master page content is not displaying,what may be the reason?the master page code--->
I have added a favicon to my site but it will not appear. I have the following two lines in the master page markup:
[Code]....
When the first page that uses the master page is rendered in the browser, these links are:
[Code]....
This is as I would expect yet the favicon does not appear. It appears fine on any basic html pages but simply won't on any pages that are based on the master page.
Private _theskin As String Public Property theskin() As String Get Return _theskin End Get Set(ByVal value As String) _theskin = String.Empty End Set End Property
I was then expecting to be able to access these properties from the default.aspx.vb page in this way;
If Master.theskin = foo Then do things End if
In the default.aspx.vb the code is highlighted with blue underline and says;
theskin is not a member of system.Web.Ui.Masterpage
Am I making an error somewhere along the line? Do I need to do more to be able to expose the properties to default.aspx.vb?
My hosting service is all messed up and my application keeps recycling. I am not able to figure out why my application is recycling. I am told that my application is using more than 100MB allocated memory but I just do not see what is wrong or how much is the optimized memory is required for my application. So in my master page I am trying to capture if one of the session variables is null and redirect to login page in the master page.in my master page I have the following code:
if ((Request.Cookies["UserID"] != null)&&(Session["UserID"]!=null)) { do something;
[code]...
Object reference not set to an instance of an object. referring to the session["UserID"] being null in the page where I thought the master page will handle the null value for the session before the page!
my Master page placed textbox & link button. Linkbutton event raise only if clicked twice, is there anyway solution for raise the event in single click
Some time ago I converted an old windows application to a web application. This web application works fine as a stand alone app. I was recently informed that my client had a new standard layout and they are using a master page. They sent me the master page.
The web application is quite basic in that it makes a number of calls to a web service to retreive a list of customer, retrieve list of products and allows customer to create an order containing products.
I did the following to get make use of master page:
Copied it to my solution Update the page directive to include the MasterPageFile attribute and set it to point to master pageAdded the relevant content areas to my page Copied my code (control declarations etc) into the relevant content areas.The application compiles correctly and renders as expected. However, it does not behave as expected.
For example, I display a list of customers in a GridView. The user can select a customer by clicking the select button that is present for each row in GridView. I do this once and select a customer the page is posted back and relevant row is selected. I select a different customer and the page it posted back but this time the selected row does not change. It is still shown as the first row i selected.
This functionality works as expected if i remove the master page attribute and content areas.
I have created a master page for website layout in my project. I have used a linkbutton control to trigger between Login/Logout functionality but when I click on this control the underlying click event handler is not being executed anyway.When I click on this control, the page pointed by its PostBackUrl property is open which should probably occure after its click event hander have been executed.
I'm building my asp.net 4.0 website with url routing. It works great, except that I have stumbled upon one problem. The problem is that when a logged in user is on one of the non-public pages and gets loged out, the return url is set to the page he or she was previously visiting. When logging in again, the ReturnUrl is non routed url (something like login.aspx?ReturnUrl=somethingsomething). This poses a problem for some of my pages where I have a default value stored in the route; it simply doesn't get picked up with the non routed url of the ReturnUrl.The result is a broken page (404).
I've been working with ListView for a long time, but I haven't been using it's built-in events so far. Now I was trying and was stuck. Until I moved both LinqDataSource and ListView to another page, without a master page.
Then it worked. Same happened with GridView as well.
I do not use Update Panel. Just master page. And if I use manual methods for edit, insert, delete then it doesn't fire OnItemCommand.
Is there a known uncompatibility with databound controls and master pages? Because I couldn't find anything about it on Google.
I am trying to use Matt Dotson FrozenGrid View [http://blogs.msdn.com/b/mattdotson/archive/2006/03/02/542613.aspx] in Master/Content page but the header of the gridview doesn't get fixed. I tried putting gridview inside the panel and but no luck.
i have tried autocompleteextender using page method and without master page and its working. but now im try to put them into master and its not working. this is my code***********pagename.ascx
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'm using ajax autocomplete extender(from database). Its working fine in content page. But its not working in Master Page. I'm using VS2008. I'm using webservice...
I have two master pages: TopLevelMaster and NestedMaster
When my page points to NestedMaster as it's master page, intellisense quits working in the .aspx page.
If I change my page to use TopLevelMaster as it's master page, intellisense works.
No matter what I use as the master I always get a green squiggly underline under the Content control that brings up a tooltip that says "Could not find ContentPlaceHolder1" in the current master page or pages"
TopLevelMaster exists in a different project than NestedMaster and the page.
When I say "intellisense quits working" here is what happens:
If I type something between the Content tags I get no intellisense for asp controls:
Only html controls appear upon typing an open angle bracket here
</asp:Content>
If I instert a div element I can type an opening angle bracket and I see a list of all asp controls. If I choose one and start typing there is no intellisense after that:
<asp:Content ID="Content1" runat="server" etc.., etc..> <div> ASP controls appear but no intellisense other than asp:ControlName </div> </asp:Content>
Opening one or both master pages in the IDE has no effect.
Modal popup not working, I need to open modal pop up inside a panel, below is my html, senerio goes as :
On page load on only panel with id="pnlgrid" is visible and button with id btnaddnew is visible on clicking addnewbutton panel grid is visible false and panel with id=pnlFormEdit is visible true.
Inside there is linkbutton1 on which click i want to open popup. but on clicking it goes postback.