asp.net-mvc

ASP.NET MVC Validator Toolkit - without Code Behind

RenderValidationSetScripts() produces only the script tags as output if I am using Views without code behind. Is there a solution or is it simply not working? ...

IE (6 & 7) iFrame Querystring Parameters Set In .NET MVC Page Not Working, Seemed Stripped, But Appear In Tact On Page Source

We're using .NET MVC, and we're trying to dynamically (through the controller) set the iFrame's URL. This worked fine on FireFox and Chrome, but not Ie. On Ie only the first case site lets the user log through correctly. The v10 and v9 sites don't. All sites use querystring params to log in. Their source looks like this (unsuccessfu...

rules/attr in jQuery validation

I'm trying to add custom validation to a dynamically created control. Can I use .attr() to set a rule for a control? $.fn.addValidationExpression = function(field) { if (field.ValidationExpression != null) { $("#fld"+getFieldIdSuffix(field)).attr("validateExpression", field.ValidationExpression); } return this; }...

ViewModel Best Practices

From this question, it looks like it makes sense to have a controller create a ViewModel that more accurately reflects the model that the view is trying to display, but I'm curious about some of the conventions (I'm new to the MVC pattern, if it wasn't already obvious). Basically, I had the following questions: I normally like to have...

How do I get just the exceptions from ViewData.ModelState with Linq?

Hi, I wrote the following code to extract out the exceptions along with a string key referencing the property from the ViewData.Modelstate property in ASP.Net MVC. I think it should be possible to do this with a Linq expression but it utterly flummoxed me. var exceptions = new Dictionary<string, Exception>(); foreach (KeyV...

Error using Model reference in strong-typed View in an MVC project

Hi! I am trying to create a new strong-typed view for an MVC project. I tried to create it both from the Controller class (right click -> add View) or directly from the Views (right click -> Add view) and selected it to be a strong-typed view. From the drop-down, I selected the Model and data class it should refer to. While filling in ...

How to Implement Password Resets?

I'm working on an application in ASP.NET, and was wondering specifically how I could implement a Password Reset function if I wanted to roll my own. Specifically, I have the following questions: What is a good way of generating a Unique ID that is hard to crack? Should there be a timer attached to it? If so, how long should it be? ...

Should I store _method=PUT/DELETE in the post or in the url

I'm using ASP.NET MVC to build a RESTful web application and I plan to tunnel PUT and DELETE requests through POST as it seems like the most pragmatic workaround. What I'd like to know is, should I tunnel the information through the url like this: <form method='post' action='resource?_method=DELETE'> <!-- fields --> </form> Or sh...

How do I set up a universal controller in ASP.NET MVC?

I know it's not perhaps in the true spirit of MVC, but I just want to have a single global controller that always gets called no matter what the url looks like. For example, it could be: http://myserver.com/anything/at/all/here.fun?happy=yes&amp;sad=no#yippie ...and I want that to be passed to my single controller. I intend to obtain t...

What's wrong with my url encoding?

In my asp.net mvc application I created the following link: http://localhost:2689/en/Formula.mvc/351702++LYS+GRONN+5G+9%252f2++fds I get error 400 (bad request). I think it blocks at the %25 (forward slash). What am I doing wrong? --EDIT 3-- I tried not encoding anything at all but rather rely on the default encoding of Url.Rou...

ASP.NET MVC Readonly Field Based on Action in Partial View

When using a partial view in ASP.NET MVC to encapsulate the creating/editing markup, what is the best way to change which control gets rendered based on the action? For example, I want to only allow an email address to be entered upon account creation (via a textbox) and then viewable (via plain HTML) when viewing the account. In pseud...

How to check what URL a RedirectToRouteResult will make?

In my asp.net-mvc project I do a redirect from a post request to a get request. In between my redirect and my arrival of the method I expect it to arrive, one of my parameters magically turns into null and I can't figure out why. Probably it has something to do with my global.asax (route defenition). The only way I can come up with to d...

How to retrieve data from the html table?

Hi, I will generate html table dynamically with some textbox and dropdownlist, user will enter their input in that. How to read these data in the controller?(MVC) ...

ASP.NET MVC - Missing "Convert to Web Application" option

I created a new MVC project and added some webforms pages to it in an effort to start adding new pages to my app using MVC and eventually port the old pages over as well. Everything is building and working correctly but I did notice that I don't have the "Convert to Web Application" option when right clicking an aspx file. And I think i...

How do I add NUnit as a test framework option for ASP.NET MVC to Visual Web Developer 2008 Express?

According to Professional ASP.NET MVC 1.0, page 8, "If you are using VS 2008 Standard Edition or Visual Web Developer 2008 Express you will need to download and install the NUnit, MBUnit or XUnit extensions for ASP.NET MVC in order for [the Create Unit Test Project] dialog to be shown." Is there such an extension available to download f...

Replacing a <tr> using ASP.MVC Ajax

I have the following ajax form tag: <% using (Ajax.BeginForm("Edit", new { controller="Properties", id=Model.Id }, new AjaxOptions() { UpdateTargetId="item-"+Model.Id }, new { id="property-form", name="property-form" })) {%> When the form is submitted, the controller returns a partial with a full row to be inserted into the t...

How to pass Form Values to the Controller in .NET MVC

In ASP.net MVC: How should/Can I pass Form data (From the View) to the Controller? This is the way I am heading : The Controller Index function is passing a ViewModel object to the View. The ViewModel object contains a paginated list as well as some SelectLists. _ The ViewModel object also contains a custom class I named theFilter....

Login screen in ajax result - Asp.net Mvc

When you're using the asp.net membership and you have the [Authorize] tag on a controller / Action, sometimes when you get back from getting coffee / a walk whatever, you have been logged out of the site. When you click a button or link that invokes an Ajax call, the returned html is not what you requested but the login screen, which the...

Using LinkBuilder.BuildUrlFromExpression

I'm trying to use LinkBuilder.BuildUrlFromExpression from the Microsoft.Web.Mvc inside an ActionFilter and am wondering if this is the best way to get urls using strongly typed parameters: LinkBuilder.BuildUrlFromExpression<HomeController>(filterContext.RequestContext, RouteTable.Routes, x => x.Login()); ...

How to render Active Reports WebViewer in ASP.NET MVC

I asked this question in the DataDynamics forum earlier today. I thought that maybe I'd get some sort of response here at SO. I am trying to get the WebViewer up and running in my ASP.NET MVC application. I am attempting to render the webviewer in the controller (webViewer.RenderControl(htmlTextWriter) and then put the results into Vi...