asp.net-mvc

ASP.NET MVC singleton or static class to pass around data?

I'm creating a controller that will serve the combined/minified versions of my JavaScript and CSS. I need to somewhere along the line define which scripts/styles to be loaded. When a request is made, for example for style.css?VersionNumberHere, it will check if the combined/minified data is already in the HttpContext.Cache, if so spit i...

ASP.NET MVC Inline Edit

I am building an MVC 2 web app, where I want to display information about something (the parent) as well as child details which are displayed as rows (children have a many to one relationship to the parent). I have implemented AJAX in MVC before using Ajax.BeginForm and partial views Using this method - with minor changes for MVC 2 rel...

Easiest way to alter required validation message site wide

I would like to replace validation message for all model properties that have [Required] attribute from the default "The XY field is required." to "*". I want to do that site wide in one place without having to add a custom message to Required attributes or passing additional parameter to ValidationMessageFor() Html helper. Any ideas? ...

applicationstate in mvc

I'm using Application[""] to store a few lists of very small size. I would ideally set it at only place.. Application_Start... but is there a chance the data might get lost in middle and I might have to store these lists back in Application inside places other than Application_Start? If yes, should I be prepared for any kind of race cond...

How to merge web.configs for ASP.NET MVC and plain ASP.NET app

Merging the web.config files of a legacy ASP.NET App and a new MVC app has pretty much defeated me. Is there a way I can build my solutions with projects sectioned off into subfolders? EG (each project to have its own web.config): ~/PlainVanilla/ /* original asp.net app - still some life in old dogs */ ~/PlainVanilla/StrawberryMV...

Edit in a new page with jqGrid

Hello, I would like to edit the rows of my jqGrid in a new page. I have setup a custom function for the edit button with the use of the parameter "editfunc". How can I redirect the user to that page within the javascript function? I am using asp.net MVC 2. ...

ASP.NET MVC many to many model on client side

I have 3 many-many tables: Users -< UserRoles >- Roles. I set up my model like this: public class User { public int UserId {get; set;}; public IEnumerable<Role> Roles {get; set;}; } public class Role { public int RoleId {get; set;}; public string RoleName {get; set}; } public class UserDisplayModel { public User Us...

finding the action name inside post method of an ascx - asp.net mvc

I have a partial control formy.ascx that I am using on a lot of pages that contains a form. When I click submit on the partial control, following function handles the form submission. [ActionName("FormyTemp"), AcceptVerbs(HttpVerbs.Post)] public ActionResult FormyTemp(FormCollection result) Now, I need to know what page i.e. action...

application compiles every 15 minutes

I am using ASP.Net4 MVC2 for my application. The first person using the application usually experiences a long wait before the application responds. After that the application is pretty responsive. If the application is idle for 15 minutes, the same person or the next person using the application will experience long wait again. It l...

New project for ASP.NET MVC 3 Beta not including unobstrusive validation Javascript files

My problem today is rather simple, but its driving me nuts! I just downloaded and installed the ASP.NET MVC 3 Beta and created a new project using VS 2010. But when I check the scripts folder, there are none of the following files there! (from what I understood, they should be there): · /Scripts/jquery.unobtrusive-ajax.js · /Scripts/jq...

JQGrid with xml file as data source

How can I edit a xml file using JQGrid? I am using ASP.Net MVC 3.5 with C#. Is it possible to return a JSon object from controller method for this purpose? ...

How to be able to select master pages that are provided by a VirtualPathProvider

We got a lot of intranet websites that share the same design. Therefore we've put the master pages, stylesheet, images and javascripts in a shared assembly. The content is loaded by using: HostingEnvironment.RegisterVirtualPathProvider(new VirtualFilesProvider()); ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new WebFormViewEng...

hot to creat a restful web service for MVC & use it?

I am working in asp.net mvc & want to create a restful web service. Can you please let me know how can i create a restful web service in MVC & how can i use it ? My requirement is : i have an application server which send some parameters to web service & the web service should connect to remote server & return image on path (whose path w...

ASP.Net MVC help with refactoring

I'm quite new to both ASP.Net and MVC. I got the following code in my master page: <div id="main-menu" class="menu"> <% var items = (IList<CompanyName.Framework.Web.MenuItem>)ViewData["MainMenu"]; if (items.Count > 0) { %><ul><% foreach (var item in items) { if (!string.IsNullOrEmpty(item.RequiredRole) && ...

date search on solr using mvc.net(how to define custom date time field in schema)

hi... I am using solr for search in mvc.net application,and its working very well. but now i want to search on solr by date, so when i add a new node for date in my xml and try it to post on solr thn it gives some error like (unknown field 'date').... thn i add new field in solr schema nemed ('date'), so plz tell me what type i define ...

dynamically generating an Enumerable object of a specific type from a string representation of the type

I'm trying to design a solution in MVC in which a string representation of a class is passed to the controller which should then build a grid with all the data belonging to that class in the DB. (I'm using an ORM to map classes to tables). //A method in the Model that populates the Item Property foreach (MethodInfo method in...

How to check current user role on Site.Master page?

I need to write a menu in Site.Master where certain menu items have to be visible or not depending on current user role. How can I check that from the page? Usually would just write the logic in a controller, but the Site.Master doesn't have one (in my project at least!). I'd appreciate any pointers. ...

Dropping Json object on html page in asp.net mvc2

Hi, i m using asp.net mvc2 and i want to drop some json objects from my controller similar to validation metadata. when we call Html.ClientValidation() before our form it drops some javascript on the page like <javascript type="text/javascript"> <!--CDATA[validation metadata]--> </javascript> i want to have some json objects dropp...

Submit array param with jQuery ajax/load

public ActionResult DoSomething(string[] arr, bool someBool, int someInt) { } trying to call the above method from jQuery: var test = []; test.push('dog'); test.push('cat'); $container.load('MyController/DoSomething', { 'arr[]': test, 'someBool': true, 'someInt': 1 }, function(response, status, xhr) { ...

ASP.Net MVC TreeView using JQuery - persist by location and cookie

So as the name suggest I have a treeview in an mvc view that persists by its location but sometimes you travel off the route of the tree, for example: Main page ----Child Page Say i went to an edit page for the details on the child page, I would still technically be in the child page node but the url for the page is different. If I ...