asp.net-mvc

ASP.Net MVC, ViewPage<Dynamic> and EditorFor/LabelFor

I'm playing with MVC3 using the Razer syntax, though I believe the problem to be more general. In the controller, I have something like: ViewModel.User = New User(); // The model I want to display/edit ViewModel.SomeOtherProperty = someOtherValue; // Hense why need dynamic Return View(); My View inherits from System.Web.Mvc.ViewPage ...

JQGrid trigger("reloadGrid") in ASP.NET MVC not firing

I'm not sure how to use trigger("reloadGrid") to refresh a JQGrid. I've tried many things but none of them will get trigger to fire. I have a grid I created through ASP.NET using the MVC dll from JQGrid. Now I'm attempting to change the grid onload of the page. $(document).ready(function() { $('#myGrid').setGridParam({rowNum: 20}).t...

Problem with Ajax.ActionLink

i am reading the professional asp.net mvc book and implement the nerd Dinner example and when start to use Ajax : <%: Ajax.ActionLink( "RSVP for this event", "Register", "RSVP", new { id=Model.DinnerID }, new AjaxOptions { UpdateTargetId="rsvpmsg" }...

Asp.Net MVC - JQuery remote validation

I got the following JQuery validation script : <script type="text/javascript"> $(document).ready(function() { $("#myForm").validate({ rules: { "Content": { required: true, rangelength: [20, 1000], remote: { url: "/RemoteValidation/IsValidContent"...

Render ViewUserControl from Class Library

I want to render some HTML to use in an e-mail. I have a collection of objects that represent rows and columns, so I could be rendering the HTML in pure C# code using a StringBuilder. But I prefer to have a ViewUserControl or just a ViewPage in a class library, that does the rendering. I want to be able to use the ViewUserControl and th...

Object property validation in MVC (using web service)

Hi, I have an ASP.Net MVC site, which connects to a web service. The site's view model contains objects for each group of required service data AccountDetails (containing AccountId, AccountType, etc.), ContactDetails (containing Name, Address, etc.) and so on. The service has a 'CreateUser()' method that accepts these objects as para...

What's so RESTful about ASP.NET MVC?

REST has been such a popular buzzword for the last couple of years (or so) and when ASP.NET MVC was rolled out, everyone was relating REST with ASP.NET MVC. I also fell for the buzz and from the lack of my knowledge, my understanding of REST was simply just: REST = SEO/User friendly URLs But it's so much more. And the more I learn abou...

Linq to Sql with Stored Procedure

I am trying to use stored procedure in dbml, but I get below error. The Stored procedure has multiple join tables, but it returns a row. public static List<SP_EMP_MASTER_DETAILResult> GetEmployeeDetail(string userName, string userLocation) { var query = (from q in db.SP_EMP_MASTER_DETAIL(userLocation, userName) sele...

How to change the theme of the jqGrid?

Hi every one, I'm looking for the way to change gqGrid theme for the current version. I've started to use jqGrid in my ASP.Net MVC 2 application recently and download some demo solution/projects. I tried to change the theme of the grid by changing the theme ui javascript but it doesn't work for me. Looking at the document doesn't help m...

How to get rid of empty data in Craig Stunz's demo application ?

I download Craig Stunz's demo application from his blog and run it from Visual Studio 2010. The result is the grid with its UI but no rows. What should I do to make it works? ...

Asp.net mvc with entity framework problem : creating or updating an address for a contact . Address Fill with Ajax Request.

I have 2 related entities: Contact and Address. There is a relation between each other. 1 Contact with 1 Address. In the create Form, I fill the FirstName and LastName text boxes. I have a field related to the address. In some situations, I perform an AJAX request to fill automatically the Address Info. The problem is: when I click s...

strategy for passing nhibernate entities between pages

I am working on a customer sign-up workflow. As expected, there are multiple steps that collect information. I need to store the results of each step until the workflow is complete. Once the workflow is completed then everything is written to the database. If the user leaves the workflow half-way through they will have to start over from...

Managing routes/Global.asax maintainability

Is there any best practice for how to best define and organize routes in MVC? The company I work for runs a very extensive, complex ecommerce site with ~600K unique visitors/day. Here's the problem: in our Global.asax.cs, we've got this HUGE list of approximately 75 route definitions in our RegisterRoutes(): routes.MapRoute( "Defa...

ui-dialog open event executed from a .net mvc controller action

hello, If I want to use a jquery dialog in order to display an error message submited from a .net mvc controller action, what I have to do? could you give me an example? thanks a lot for helping! ...

For MySQLMemberShipProvider read the connection string from external file

In my asp.net mvc application, I am using MYSQLMembershipProvider. I want to read the connection string of Membership provider at run time from external file. I am using MYSQL Connectore 6.3.4 How can I read the connection string from external file for MYSQLMemberShipProvider???? Please suggest me the way. Thanks Aayushi ...

ASP.NET MVC - HybridViewResult (ViewResult /PartialViewResult)

Is it possible to build a hybrid ViewResult that returns in depedency of an AjaxRequest or HttpRequest a PartialViewResult or ViewResult? IsAjaxRequest --> return PartialViewResult !IsAjaxRequest --> return ViewResult As far as I know my HybridViewResult should derive from ViewResultBase. But how to implement the FindView method? ...

Entity Framework testing with IRepository - problem with lazy loading

I am refactoring an MVC project to make it testable. Currently the Controller uses the Entity Framework's context objects directly to ask for the required data. I started abstract this and it just doesn't work. Eventually I have an IService and an IRepository abstraction, but to describe the problem let's just look at the IRepository. Ma...

Hosting php page in my asp.netwebsite iis6

Hi, Iam having an webservice which is in php i want to host it in my website which is (asp.net). please provide me the steps how can i go through it. Thanks ...

ASP.NET MVC: Cities list and store selected city in cookie

I have list of cities on my site, this list placed in Site.Master and look like: <a id="<%= selectedCity.CityId %>"><%= selectedCity.Name %></a> <ul> ... <li id="<%= city.CityId %>" > <%= Html.ActionLink(city.Name,"ChangeCity",new{ newCityId = city.CityId })%> </li> ... </ul> Next, all my controller are based from ...

ASP.NET MVC localization using DisplayAttribute

I want to localize my resources (form labels, validation messages etc) using DisplayAttribute. I have my resources in the database, but looks like DisplayAttribute uses the resx files, and the class is sealed itself so I cannot derive a subclass and override the require methods/properties. Is there any way of handling the resourcemanage...