.net - RouteUrl And RouteLink Not Working?
Jan 15, 2011
I just upgraded to MVC3 final and a part of my site that used to work has totally stopped working. Any idea where my URL's have gone or how to get them back?
Global
routes.MapRoute(
"SingleArticle",
"Articles/{action}/{year}/{month}/{day}/{key}",
new { controller = "Articles", action = "Archive", year = 0, month = 0, day = 0, key = "" },
new { year = @"d{4}", month = @"d{2}", day = @"d{2}" }
);
cshtml
var routeLinkData = new {
action = "Archive",
year = item.PublishDate.Value.Year,
month = item.PublishDate.Value.Month,
day = item.PublishDate.Value.Day,
key = item.NameKey };
URL="@Url.RouteUrl("SingleArticle", routeLinkData)"
Link="<a href="@Url.RouteUrl("SingleArticle", routeLinkData)">Link</a>"
Output
URL=""
Link="<a href="">Link</a>"
View 1 Replies
Similar Messages:
Jun 17, 2010
I have isolated the problem in two project which are the same except one targets 3.5 and the other 4.0This is breaking my app, and really causing major headaches.This is the mapping of the route:
[Code]....
Which uses a custom contraint:
[Code]....
This is the controller Action
[Code]....
In Home/Index.aspx I have created a few links:
[Code]....
All link have a different link text wich I use here to reffer to themThis generates the following links which are in my opinion faulty in both frameworks, but 4.0 offers no workaround.In 3.5:
actionlink = /Home/Special (?)
actionlink routevalues = /MyPrefix (This is what I want)
routelink= / (?)
[code]...
View 6 Replies
Jun 28, 2010
I was reading the ASP.NET MVC Best Practices article by Rashid, and got stuck in his description of creating UrlHelper extensions. Doing this is easy enough, and I've adopted the practice into all of my projects. I noticed, however, that Rashid used Url.Content to generate the url for the home page, and Url.RouteUrl for all the other urls. Why is this? What is the difference between the two?
The link to the blog post is here:
http://weblogs.asp.net/rashid/archive/2009/04/01/asp-net-mvc-best-practices-part-1.aspx
I've used Html.ActionLink in my Views, but I'm wondering what difference it would be if I used Url.RouteUrl instead. Does anyone have a good grasp of what makes these helpers different, and where they are best used?
View 1 Replies
Feb 3, 2010
to pass existing route values using the RouteUrlExpressionBuilder syntax?
I mean, having a page route, say, 'Countries/Great Britain', how can I get a hyperlink with NavigateUrl="<%$ RouteUrl: RouteName=cities,country=*current*,city=London %>" without using codebehinds?
View 4 Replies
Jun 23, 2010
I would like to build hyperlinks into my website who implement the routing techniques from ASP.NET 4.0. but ik can't seem to find a way to use the RouteUrl with changing values
[Code]....
In the code above (part of a GridView) i would like to bind to the routename "CustomerRoute" en provide the parameter "CustomerID" which gets its value from the field "CustomerID". But his doesn't seem to work.
View 1 Replies
Mar 28, 2011
I'm currently doing something in OrchardCMS we're using URLRewrite so that if a user comes to the site from site.com or from site.com/orchard, they get the site.com/orchard page. One of the problems is that it's throwing the urls in the menu because it's using urlHelper.RouteUrl which uses the wrong context and then produces a url like site.com/page1 rather than site.com/orchard/page1. Is there either a way to tell urlHelper.RouteUrl to start from a different page than the current one, or to get the function to return the full path?
View 2 Replies
Jan 27, 2010
I have a project that it had been developed under MVC1 and after aa few months ago I upgraded it in MVC2.
Everything was well, uppon the day I needed to format my computer.
And what can goes wrong with a format? I don't know
I have installed the MVC2, I build the project, no error displayed, but from the time I've uploaded the project in the production server
I am getting this error.
Method not found: 'System.Web.Mvc.MvcHtmlString System.Web.Mvc.Html.LinkExtensions.RouteLink(System.Web.Mvc.HtmlHelper, System.String, System.Object)'.
I can't understand what caused the problem.
Certainly I assumed that is have to do with MVC1 and I referenced it, but with no luck
again.
Theese are the methods that the problem is came from
[Code]....
View 15 Replies
Aug 30, 2010
<%= Html.RouteLink(">>>", new { page = (Model.PageIndex + 1) },null)%>
Is it possible to set image instead ">>>" and how?
View 2 Replies
Mar 8, 2010
On MVC 1 project I had the following working:
[Code]....
I have:
[Code]....
But I get two errors:
The name 'Content' does not exist in the current contex.
The name 'Url' does not exist in the current context.
Did something changed in MVC 2 regarding these?
I have been tryng to find the solution but no luck.
View 3 Replies
Aug 13, 2010
I created a one Java script calender. Its working fine in ie6 but its not working in firefox. I'm new to this java script so kindly give your suggestion as soon as possible.
Page
Language="C#"
AutoEventWireup="true"
CodeFile="Default.aspx.cs"
Inherits="_Default" %>@
Register
Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI"
TagPrefix="asp" %>
DOCTYPE
html
PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN".......................
View 1 Replies
Mar 9, 2010
i m facing a issue in my code i m calling a user control which is in master page, and in row databound i m calling it and it is working fine but on select index change of checkbox it is not working
protected void chkIntClient_SelectedIndexChanged(object sender, EventArgs e)
{
UserControls_AlwaysVisible uc = this.Page.Master.FindControl("Alwaysvisible") as UserControls_AlwaysVisible;
uc.Visible = true;
ArrayList raters = new ArrayList();
CheckBox chkselproducer;
[code]...
View 7 Replies
Nov 19, 2010
After the implementation of ajax drag and drop, we have observed that which is working fine in IE and Firefox and not in chrome and safari, In Google chrome and Safari when we try to drag a module, the page getting scrolling to the top of the page.
View 1 Replies
Jan 25, 2011
OK Here is the situation:
I have a web app with a table of statistics on our salesmen's customers, and each row has a sparkline graph showing the general trend of the sales data for the last 12 months. Each page shows a particular salesman's customer list, and some of them can have an enormous number of customers = an enormous number of rows = an enormous number of sparklines (e.g. one in particular has 125 and takes 15 seconds to load).
For this reason, jQuery sparklines could not be used - they completely pinned the CPU of a user accessing a page with a lot of sparklines with IE.
So I moved on to using the Google Chart API, which worked much better, except for two issues: 1) it's on a secure site, and the Google Chart API URL is only served over HTTP (solved by using a small wrapper script to download the graph dynamically and re-serve it from our secure server); and 2) on a page with 125 sparklines, it was still very slow due to the number of requests (even when the 0-9 server prefixes are used to maximize the # of available connections).
So my next step beyond this was to try to make each of the "download/grab/re-serve image" method calls asynchronous - and it worked!
...but only on my dev box running in debug mode.
When I pushed it up to the live site, it was faster, but it left some of the images unloaded, which is of course unacceptable.
So here is what I was hoping some SO hotshot would know:
1) Why are my asynchronous method calls working while debugging, but not working on the live site?
2) Is there any easier way to get a large number of sparklines of some sort to load quickly on a secure server without making me want to tear my hair out?
2a.) Does anyone have any experience using the ASP.NET Chart Library? Is this something I should investigate?
2b.) A co-worker suggested I make my own sparkline routine using a 1x1 CSS background image and varying the height. The problems are a) it is completely un-extensible in case we want to make changes; b) it seems hacky as hell (leaves about a bajillion DIVs per sparkline in the markup); and c) I have no idea if it will be fast enough when there are 100-200 of them on one page - what are your thoughts on the feasibility of the 1x1 sprite approach?
View 2 Replies
May 21, 2010
I mean, what is the faster way to get as fast as I can more than one table with stored procedure? Is there any study what is faster and why? There is a big problem getting more than one table at once with Entities, so the only way is DataSet. But I was told DataSet work very slow. Is that true?
View 2 Replies
Jan 15, 2011
I am using vs2008 pro. my problem is that javascript debugger is not working on mozila firefox but working fine on IE8.
View 1 Replies
Feb 23, 2010
Url rewriting not working on live server in asp.net but locally working fine. but locally it's not case sensitive.
View 1 Replies
Feb 21, 2011
I have a login control that is working beautifully on my localhost, but not working on the server. It validates my username & password - and gives me an error if I enter an invalid username/password. However, if I enter the correct username/password, the page refreshes, but does not redirect me to the "ReturnUrl" that I see in the URL. I've seen posts on this, but nothing that I tried worked. I've tried setting the 'MembershipProvider'attribute of the login control. I don't want to set the DestinationUrl...I want it to take what is in the ReturnUrl in the querystring. I don't think it's a web.config issue cuz it works on localhost??
View 3 Replies
Mar 18, 2010
Window.open javascript function is not working in Mozilla, but working in other browsers, here is what I have write.
<a href="javascript:window.open('../Terms.aspx','Terms','width=550,height=400')">
click here</a>
Actually what happened in Mozilla is popup is opened but parent window is blank with [object Window]
View 2 Replies
Apr 26, 2010
I want to export the grid data to excel then write the following code but the following lines of code are working at firefox3 but not at ie8(no response).
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.AddHeader("Content-disposition", "attachment;filename=ProjectTimeSheet.xls");
System.Web.HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
string excelFile = "";
excelFile = ConvertToExcel(PrepareGridViewForExport()); //generate formated table for excel
System.Web.HttpContext.Current.Response.Write(excelFile);
System.Web.HttpContext.Current.Response.End();
View 4 Replies
Aug 19, 2010
My application is working fine in local environment but not working after push code in live. My locale environment and hosting environment both are having same configuration. Same app working fine 2 month before but in different domain but same hosting server.
how to check the both config / any possible to run debug mode in hosting server please let me know. below code used in all page for checking user session status but when I click on any link page redirect to login.aspx I think session got timeout. I don't know why session got time frequently, but this issue not happening in local environment (desktop).
[Code]....
[Code]....
View 6 Replies
Jul 9, 2010
Am trying to get a working enity model with foreign keys working but have run into a problem. I have imported 3 tables with content and some data.Lets call these tables geo_countries, geo_counties, geo_municipalities and the FK are:1. geo_county have a column country_id wich corresponds to country_id in geo_country 2. geo_municipality have a column county_id wich correspond to the county_id in geo_county.The problem i have is when i try to get correspondig child items with the following code i run into trouble:
[Code]....
The problem above is that 'test' generates results but not 'test2', wich never return anything. Am i not supposed to be able to do it like i do in 'test2'? I earlier tried to add a child object by replacing ToList() with Add() and that worked. But i cant seem to get anything out of it.
View 4 Replies
Aug 28, 2010
If Not IsDBNull(ext) Then
ext = LCase(ext)
End If
Select Case ext
'Case ".htm", ".html"
' type = "text/HTML"
'Case ".txt"
' type = "text/plain"
'Case ".doc", ".rtf"
' type = "Application/msword"
'Case ".csv", ".xls"
' type = "Application/x-msexcel"........................
View 5 Replies
Jan 10, 2010
Until the Dec 29th my website was working fine. Then My fileupload problems started happening. My fileupload page would simply quit and say the page can not be found. I maximized all my timeout settings and that did not work. I called my hosting company and apparently they have no problem using my page to upload files from their geographical area. So then I concluded it might be a network problem. I ran a trace route and could not really figure out where the problem was. So, I have no idea what is going on. Is it possible that my site is being blocked by some black list out there somewhere?
View 3 Replies
Feb 5, 2010
i do have a form. inside specific asp:textboxes are "secured" by RequiredFieldValidator and RegularExpressionValidator running. in another div-element i do have buttons, which are expected to load different pages of my website. the problem is: when i click on either of these buttons it is not working as my validation-controls are fired prior to the onclick-button-events.
View 10 Replies
Aug 5, 2010
i made a after delete trigger on a table1 and in this trigger i insert the deleted data in another table name tab2.
when i execute the delete stored procedure of table1 from sql server 2005 then trigger working fine but when i execute delete stored procedure of table1 from c# then it is not working properly.
View 1 Replies