x.BeginForm() and ViewData
I have a view where I initially used Html.BeginForm(). After POSTing, I show a message with ViewData["Message"]. That works fine. When I change to Ajax.BeginForm(), ViewData["Message"] is null. What am I missing? ...
I have a view where I initially used Html.BeginForm(). After POSTing, I show a message with ViewData["Message"]. That works fine. When I change to Ajax.BeginForm(), ViewData["Message"] is null. What am I missing? ...
Hi I'm trying to figure out a good way to have 'global' members (such as CurrentUser, Theme etc.) in all of my partials as well as in my views. I don't want to have a logic class that can return this data (like BL.CurrentUser) I do think it needs to be a part of the Model in my views So I tried inheriting from BaseViewData with these m...
I use an overload of Begin.Form that accepts routeValues <% RouteValueDictionary routeValues = ViewContext.RouteData.Values; routeValues.Add("TestRoute1", "test"); using (Html.BeginForm( "Category", "Home", routeValues, FormMethod.Post )) { ...
I'm writing a web service (using ASP.NET MVC) and for support purposes we'd like to be able to log the requests and response in as close as possible to the raw, on-the-wire format (i.e including HTTP method, path, all headers, and the body) into a database. What I'm not sure of is how to get hold of this data in the least 'mangled' way...
I'd like to have more than 1 setting for maxRequestLength - file size upload limitation (e.g. one for File/New, other for Picture/New). All of my Actions take additional parameters (e.g. /File/New?folderId=234). Single setting works as expected: <httpRuntime executionTimeout="60" maxRequestLength="1024" /> I tried to have 2 settings ...
I've set up and configured ELMAH to log all of my errors on an ASP.NET MVC project I'm working on. It will be used by a small group of users who don't need to know too much so whenever there is any sort of error (404, InvalidOperation, Y2K... anything!) I just want to show them a generic default error view with instructions to call our h...
I have a really odd issue with ASP.Net MVC. I have a form, which is posting 3 text values to an action method called create user (for simplicity sake, say it is the following); public ActionResult CreateUser(string FirstName, string LastName, string Email) { var s = FirstName + LastName + Email; return RedirectToAc...
I am trying to pass JSON data from the client browser to an ASP.NET MVC Action using jQuery $.ajax() and bind it to a .NET class using a custom ModelBinder. THE CLIENT JAVASCRIPT: $('#btnPatientSearch').click(function() { var patientFilter = { LastName: 'Flinstone', FirstName: 'Fred' }; var jsonData = $.toJSON(patientFi...
I'm trying to pass in an array to this dropdownlist in my Partial View: <% Html.DropDownList(Model.Name, Model.Options); %> The options are comma separated of course. It's expecting an IEnumerable so not sure what I'm missing here. It's not accepting the array. ...
In our ASP.NET MVC project we have a Strings.resx file and the accompanying autogenerated Strings.Designer.cs file. Tracking the Strings.Designer.cs file in source control creates a bunch of ugly merge conflicts and it's autogenerated anyway, so we decided to untrack it (remove it from source control and ignore the local copy of the fil...
I was trying to use ajax to retrieve data from a repository using a controller and I kept getting Internal Server Errors... I've whittled it down to the line: private MyDBEntities _myDB = new MyDBEntities(); That's located in the repository, without that line I don't get the Internal Server Error. The line is called after the Reposito...
For some odd reason I can't seem to communicate w/ my span or div in the view using MVC as I have shown below - what am I missing here? (for the moment please ignore the magic strings example) <span id="UserFeedback"></span> ViewData("UserFeedback") = "broken" ...
I can't seem to get the value of a select list to populate the value of the parent object. I'm using a wrapper object to bind to so that I have access to the values needed for the SelectList as well as the object which needs the value. I'm willing to bet I'm missing something basic but I can't find it. I have these models: public c...
My ViewModel class (ItemViewModel.cs) looks like this: public class ItemViewModel { public ItemViewModel(xxx.Product product) { this.product = product; } private readonly xxx.xxx.Product product; private readonly Pers pers; private readonly Item item; public xxx.xxx.Product Product { get{ return product;} } public Item Item ...
I am working on rendering a dynamic form in an ASP.NET MVC view that will meet these requirements: Fields can be validated State is preserved when the form is invalid I am looking into creating a custom model binder to achieve this. I am generally planning to do this: Form fields are defined with these properties Prompt (label nex...
I've got an ASP.NET MVC (VB) project with two models that represent two different databases. Each model needs to include a table from its database with the same name. For example, model1.dbml needs to have db1.MyTable in it, and model2.dbml needs to have db2.MyTable in it. I can't do this because both models try to create a "Partial Pub...
Does the MVC framework, whether it be ASP.NET or Rails enforce you to develop better databases? Since your database tables and fields will most likely map to classes and properties using OR/M, it only makes sense that this would force you to create a proper database structure from the beginning of development. ...
I have looked at the usual suspects...Spark, NHaml, etc. They all seem to be syntactic sugar for those that are uncomfortable with the <% %> syntax. Are there any other tangible benefits? Syntactic sugar doesn't seem to me to be a sufficient reason to change out the entire view engine. Reasons posted so far: Easier to transition fr...
I'm trying to get a json serialized object from within an MVC user control using jQuery. The problem is the result coming back is the full HTML for the page that contains my control. The page and the control use the same controller. I've tried breaking on the method I'm calling in the controller and it never gets hit. I've tried vari...
I am working on a ASP.NET MVC web site that has multiple submit buttons. i.e. <input type="submit" name="SubmitButton" value="Reset" /> <input type="submit" name="SubmitButton" value="OK" /> <input type="submit" name="SubmitButton" value="Back" /> I need to allow users to quickly submitting the form by pressing the 'Enter'...