How to configure routing in asp.net web api, to that I can code for the following actions in my ApiController inherited class?
|======================================================================================|
|Http Verb| Path | Action | Used for |…
After a week of asp.net mvc2, I still haven’t understood the advantages of ViewData.model or rather how I can properly utilize Viewdata. Can some teach me how to use Viewdata properly?
Also what’s TModel that’s associated with viewdata? How does one utilize TModel? The viewdata explanation in spark view…
Hi!
I was wondering whether there is a way to create an ActionLink or similar, that changes only a few parameters of the actual query, and keeps all the other parameters intact. For example if I'm on an URL like http://example.com/Posts/Index?Page=5&OrderBy=Name&OrderDesc=True I want to change…
Can anyone explain why the following happens? And how to resolve, Visual Studio 2010 and MVC2
<%= Html.ActionLink("Add New Option", "AddOption", "Product", new { @class = "lighbox" }, null)%>
Results in
/Product/AddOption?class=lightbox
<%= Html.ActionLink("Add New Option",…
I am migrating a site from ASP.NET MVC 1 to ASP.NET MVC 2. At the moment, the site supports the following routes:
/{country}/{language}/{controller}/{action}
/{country}/{controller}/{action}
/{language}/{controller}/{action}
/{controller}/{action}
The formats for country and language are…
When i drag and drop my image/script/css file into my view, relative path will automatically use to refer on the files.
example:
<link href="../../Content/style.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-min.js"…
Hi,
I have a site that supports localization. I would like to be able to switch between english and french.
Let say the user is currently at URL:
http://www.mysite.com/en/Home
I would like to redirect to:
http://www.mysite.com/fr/Home
If the user click…
Is there anyway to override the custom validation error messages from the ValidationAttributes?
Basically I need the ValidationAttributes to support globalization.
Thanks in advance.
i have two options
One
<%= Html.CheckBox("postType", false, new { @id = item.int_PostTypeId.ToString() })%>
Second
<input type="checkbox" name="postType" value="<%= item.int_PostTypeId.ToString() %>
1st question:
what is differenct…
I have multiple controllers with different actions (no "Index" actions). The actions I consider "default" actions, are named differently. I want to create default routes for their names and have the first available action (from my list of default actions)…
I'm fairly new to ASP.Net MVC 2 and understand the MVC pattern in itself. But my question is what's the best way to populate dropdownlists in the UI sticking to the MVC pattern. Should I be going through the controller?
Every article I've seen to do…
I've been trying to create a controller in my project for delivering what could turn out to be quite complex reports. As a result they can take a relatively long time and a progress bar would certainly help users to know that things are progressing.…
I know a bunch of people that are really enjoying the improvements that ASP.NET MVC 2 made over the first release. I have just started to migrate our MVC 1 project over and so far areas has totally cleaned up the subfolder mess we had in our large…
Assume I want to generate an element similar to this in ASP.NET MVC 2:
<%= Html.TextBoxFor(p => p.FooBar)%>
Is there an overload or way I can get ASP.NET MVC 2 to only generate a name attribute and not an ID attribute?
I can have it…
I'm trying to write an auto-scaffolder for Index views. I'd like to be able to pass in a collection of models or view-models (e.g., IEnumerable<MyViewModel>) and get back an HTML table that uses the DisplayName attribute for the headings (th…
Hi
I have a page that has a Dropdown control (ddlDeliveryMethod). So that when the user selects particular option from the Dropdown(using MOUSE), the respective Div ID's are loaded.
But instead of Mouse, if we simply use the arrow keys from…
Can I see one example that would make this piece of code compile?
public IEnumerable<RouteBase> Routes
{
get
{
return new List<Route>()
{
new Route(...)
…
While designing a master page i am adding a number of images to it.
I have an image tag inside the master page,
<img src="../../Content/Images/img19.jpg" class="profileImage" />
When i run my app, the image doesn't show up in the…
I have a weird problem. Whenever the website designer updates the css file for the website I am working on. I overwrite the old css file with the new version and copy any new images. The problem is that whenever I do this the images in the…
i using upload form like this
using (Html.BeginForm("FilesAdd", "Admin", null, FormMethod.Post, new { enctype = "multipart/form-data" }))
it uploads files success except for mp3 files, i can't understand why?i use build web server in…
Hi Experts,
Can I override an ActionResult method. Say I have a method Index in AccountController like this
public ActionResult Index()
{
return View();
}
Can I have one more method with same name but with differnt parameters
like…
Hello,
I am able to run my application just fine on my dev machine but as soon as I publish it to the web server some functionality is lost. Any type of .ajax POST does not work usually with a 401 unauthorized error.
The server is…
i am creating a generalize deleteusercontrol , my aim is that on the listing page where all the records are listed when the delete is pressed i want to display the acknowledgment on the same page up the list. I had little idea to do…
In a brand new ASP.NET MVC2 project, I want the user to be redirected to
http://<mysite>/home/index
rather than
http://<mysite>/
We do this with our other sites for tracking purposes, to avoid the scenario where…