asp.net-mvc

ASP.NET MVC 2 default resource file not needed

I use resource files throughout App_GlobalResources. Why do I need to have the default resource file? If I have MyResFile.resx (default file) and MyResFile.en-us.resx it's all fine. If I remove the default file, stuff like <%: Resources.MyResFile.Key%> from view or Resources.MyResFile.Key; from controller does not work, telling me Re...

Create URL That Matches Route From A Form

I have the following route: routes.MapRoute( "PlayerSearch", "Players/{playername}", new {controller = "Players", action = "Get"}); This works if I go to http://mydomain/players/playername. I also have a form that allows users to look up players by name: <% using (Html.BeginForm("Get", "Player...

How to remove System.Web.Mvc.UrlParameter from url

I have an action link that looks like; <%= Html.ActionLink(Model.forumItem.title, "ViewForumItem", new { Id = Model.forumItem.id, title=Model.forumItem.title.Replace(" ", "-") })%> However the url it produces is; http://localhost:50756/Home/ViewForumItem/System.Web.Mvc.UrlParameter/Clappy?Id=15 What can I do to make it look like; ...

template view to display an interface

Can I have an example of how to use a template view to display an interface have properties ID and Name ...

How to make selectedItem in a SelectList be dynamic. Anyone?????

I have a SelectList: SelectList DropDownListOfCatergories = new SelectList(UnitOfWork.ClassifiedCategories.FindAll().OrderBy(Order()), "Category", "Category"); This works fine as you can see I am ordering the list. Now when someone wants to edit something the selectedItem is alway's defaults to the first one no matter what category it...

Firefox issues with Compression Filter Attribute in ASP.Net MVC

In ASP.Net MVC 2 I am using the following compression filter and, in Chrome it works fine but in Firefox 3.3.6 it returns weird characters. public class CompressAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { //get request and response var reques...

Master ASP.NET MVC

Recently i am started working on ASP.NET MVC ( along with Linq to SQL).I am finding it difficult and confusing ( concepts like repository , controller , view are confusing me.). Can someone please tell me how to move or rather how can i master MVC. ...

Passing HTML via Post call using Ajax and jQuery within MVC

I am trying to post some HTML information to a url using the ajax post command var html = "<b>bold</b>"; $.ajax({ type: "POST", url: "/DragDrop/GetData/" + id + "?html=" + html, data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { } }); But of course you c...

pagination to asp page with model data.

hello all, I am receiving data on Browse.aspx page with the help of model now i want to add pagging to the table i am displaying ...code is... <%@ Page Title="Max 2.0" Language="C#" MasterPageFile="~/Views/Shared/Master.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<FMDomain.Models.User>>" %> <%@ Import Namespace="F...

ASP.NET MVC Server File Browsers

Hi, On my current project we would like to expose some server directories to the client so they can control their own assets/static HTML/CSS etc. The existing web forms project is being replaced by MVC and I am struggling to find an out of the box server file browser with which to expose this functionality. Here is an example for WebFo...

GridView user control with paging in MVC

Hi friends, Is ther any user control for displaying data(like gridview in asp.net). Actually i found many control which works but, i cann't reuse it. Because in each and every page i need to put the same logic. Is there any control which I can re-use for all pages? How I create user control in MVC for GridView.?? ...

Is the "publish..." action in VS2008 automatically compile in "release" mode?

I'm a bit confused about all that Does <compilation debug="true"> in web.config mean that you are in Debug mode? I guess no? Is this related to debug/release mode? Is the "publish..." action in VS2008 automatically compile in "release" mode? Where can I bind "publish..." action to "release" mode? When I "publish..." a project and if I...

What is the easiest (correct) way in ASP.NET MVC 2 to make a button-click display text?

I need to make a quick demo showing how to do interactivity on an ASP.NET MVC page. I opened an ASP.NET MVC project in Visual Studio 2010, put the view in design mode, dragged in a button, double-clicked on it and looked at the view again. I was expecting to see some ingenious JQuery code generated but instead an <asp:Button> and a <scr...

MVC 2 customErrors works locally but not live?

Here is what I have in my web.config: <customErrors mode="On" defaultRedirect="/pages/sitemap"> <error statusCode="404" redirect="/pages/sitemap" /> </customErrors> Locally this works just as expected but live for some reason I still get the vanilla 404 error page? I am using MVC 2 with Areas, throughts? ...

How do I convert DateTime format to ShortDateString in Jquery?

I have a date that I would like to convert to String format. /Date(1281067200000)/ is supposed to be 08/06/2010 12:00:00:00. How do I convert /Date(1281067200000)/ to 8/6/2010? ...

Can you reuse a LINQ datacontext in an ASP.NET MVC application with strongly typed views

Hi, I am somewhat confused on how to properly use LINQ in combination with an ASP.NET MVC strongly typed view. My situation is as followed. 1) I retrieve a single object through LINQ 2) I pass this LINQ object to a strongly typed view. (edit form) 3) The user submits the form and the controller receives the LINQ object. So my questi...

How can I use json to populate the data in a google bar chart

I am trying to use a google bar chart in an asp.net-mvc application. The sample is quite straight forward to do as a static table but i want to build up the table on the server side and pass back down to the client using ajax. Is there anyway you can populate the datatable that is used for the bar chart with an ajax call getting json...

Why is VS2010 in ASP.NET MVC2 giving me the wrong JQuery intellisense?

In ASP.NET MVC'S JQuery intelligence I am getting methods such as "constructor", "toString", etc. What do I have to do so that I get JQuery methods such as "css" and "click"? If I just rightclick on a plain .htm file and open up Visual Studio, it works out-of-the-box: ...

Getting localised resource for Models From Database in ASP.NET MVC

How to get Localized resourse for Model Data. I have searched enough on web and getting examples for only getting resource from .resx file. [Required(ErrorMessageResourceName = "LogOnModel_UserName_Required", ErrorMessageResourceType = typeof(Resources.Global))] [LocalizationDisplayName("LogOnModel_UserName_DisplayNam...

What is the best way to do SO style routes (dashes as spaces)

Just wondering what the best way to do SO style routes is. http://stackoverflow.com/questions/3459559/what-is-the-best-way-to-do-so-style-routes-dashes-as-spaces What's the best way to create routes like this? ...