MVC :: Automatically Adding Slashes To End Of ActionLink (and Similar) Link Builders?
Apr 20, 2010
By default, links are created without the forward slash suffixed to the end. It is per our company standards to always have this trailing slash. Is it possible, via a configuration or whatever, to automatically have a forward slash whenever these methods are called?
docid is set to empty string because i want to clear ambient value of docid that is present in request context. i have gone through a lot of material on internet and even tried docid=String.Empty but it does not solve the problem and gives me url like /controller/action/id?docid=x. i also write a routeconstraint as suggested but it did not solve the problem either.clear those route values comming from request context with html.actionLink. i don't want to use html.routeLink
I am developing a page that has an image element that has its source set to an action on a controller (e.g., "/controller/action". The problem that I am having is that I don't see a built in way to generate a URL (i.e., like an ActionLink's URL) without manually constructing one. At the moment, I am manually constructing the URL, but I want to move away from this. Before I write my own helper method, I thought I would check to see if one it already available. Does such a method exist?
I have a route (the first one listed) which looks like this:
routes.MapRoute( "TopicRoute", // Route name "forums/{forumSlug}/{topicSlug}", // URL with parameters new { controller = "Forums", action = "Topic"} // Parameter defaults );
I can browse to: /forums/my-forum/my-topic and the page loads fine. Yet I have a Html.ActionLink that looks like: @Html.ActionLink(item.Title, "Topic", new { forumSlug ="my-forum", topicSlug = "my-topic" }) And it won't generate the correct link syntax for me? It generates: <a href="">My Topic</a>
Similar to the "add more experience" functionality in [URL], I want to provide a "Add another location" link which should display an additional row of a set of 4 dropdowns (country, state, city, region). I'm actually using the CascadingDropDown jQuery Plugin for ASP.NET MVC [URL] for my location dropdown functionality, but I need to give the user the ability to add multiple locations. What would be the easiest way to handle this in ASP.NET MVC and jQuery?
I'm trying to build a webpage without using any asp.net data binding controls ( listview, repeaters etc.)that I'm trying to do is to use stored procedure to get all necessary items, loop through them, and bind to labels, images etc.The problem is when i want to repeat .aspx code. I'm able to do everything i want in c#, but it's really pain to create all the necessary html elements such breaklines, spans, textboxes and so on.I tried to use expression builders, but it only repeats the last value from database.
Here is my code(ASPX): [Code].... c# code: [Code]....
I have two url links (Link1 and Link 2) and one image link. Is there a way that when I click on Link1, the image url link will change to whatever the link is in Link1 and vice versa when I click on Link2? I am using c#.
For example I click Link 1, I want the href for the image link to become "http:yahoo.com"
I'm using UrlRouting in my app which is an ecommerce application. My Urls are configured as /shop/{ProductCategory}/{ProductName} I would like to use / character in the product category section so that I can show category/subcategory hierarchies e.g. /Electronics/Media-Players/ in this case this whole thing is the category but when I use it like this my current logic is thinking "Media-Players" is the product name. Is there a way to use slash characters in UrlRouting within a field?
I'm adding hotkeys to a web application in order to enable keyboard shortcuts for our CSRs to use, to reduce injury and increase calls-per-hour. I'm using an ASP.net UserControl to inject javascript into the page and it's working great. I want the control to "just work", so that when hotkeys are assigned, using a declarative syntax, if the hotkeyed letter exists in the link text, it will be highlighted automatically, so the developer doesn't have to do anything, and also to maintain consistency in visual cues. Here's the code to assign hotkeys, if it matters:
<a href="whatever" name="thirdControl">Make a <span class=hotkey">P</span>ayment</a>
but I'm not married to the idea of injecting a <span/> in there if there's a better way. How can I do this in CSS or JQuery? Is there a way to pass in a letter to a CSS style and have it change the color of the text displayed? Should I generate javascript to highlight the text when the page loads? What would/did you do in this situation?
I'm using a textbox in my asp.net project with a date extender to allow someone to enter a date. If they want to type in a date rather than select from the calendar, how can i include the slashes in the textbox for the person to enter the date as shown? such as __/__/____
I want my searches like those in Stack Overflow (i.e. no action, no slashes):
mydomain.com/search --> goes to a general search page mydomain.com/search?type=1&q=search+text --> goes to actual search results
My routes: routes.MapRoute( "SearchResults",[code]....
The search results route does not work. I don't want to use the ".../..." approach that everyone seems to be using, because a search query is not a resource, so I want the data in a query string as I've indicated, without slashes--exactly like SO does.
I am running .net 4.0 asp.net app on IIS 7. I want to know if there is an easy way of adding rows to an excel 2007/2010 (not too fussed) template file that a user can download from the server.
For example, the user might check a couple of tick boxes and clicks a button on the web page. The server does a sql query on a table and comes back with the results. I have an excel file with some headings, column titles, formatting etc. on the web app's resources directory. I want to make a copy of this file, insert each of the results as a row into this file (insert first name into cell A3, last name into cell B3 etc.). And make it available for the user to save on their disk.
Since Excel (xls) format is an "Open format", I was wondering how easy/straight forward this would be. Is it a matter of loading the excel XML DOM and inserting XML elements? What are libraries I need to use?
I have an issue that I've spent quite a bit of time trying to solve. I have a Detailsview and a Gridview that I have linked using the ID field, It has now been decided that they want to have individual pages for each Unit. I have this working for the most part, however the detailsview is not being displayed until I hit select the row in the gridview.
How do I get this to automatically display on page load?
when i delete all the pages and if i upload new pages from my system to remote server, then for one day it will run properly but after one day a new script which is shown above will automatically added to the end of every form...
i was wondering if anyone could help me with a problem i have. im not sure how to go about this exactly i have a web site for a group of ramblers
i have a master/details page which shows walks planned for the future and they can click "details" for the full details
but what i want to incorporate into it is that when they are looking at the full details there is an option to add them to it as attending by entering a user name and password (saved in a table in the database) and if entered correctly their username will be added to it as attending.
A while ago when i started using VS 2005, i found that some assembly entries were automatically added to from web.config
and i was getting annoying errors. later i found i have added unneccessary references in my application. And its a feature that assembly reference are automatically added to assembly tag in Web.config, So dev don't have to worry about it.
Recently i used Interop.OWC11.dll in my application. And ^&*# got the annoying
"CS0234: The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)"
error again.. Assembly entry was not added automatically. I checked same for existing references in my application, for them to automatic entries is not happening.... ? :(
I have to write is down in Web.config manually... I don't understand why?....
How do I do this? Basically, next to the page numbers in the GridView I want a link button to disable paging. This works, but I want the button inside the footer of the GridView, next to the page numbers.