asp.net-mvc

How to submit a form using jQuery in ASP.NET MVC 2?

I want to submit a form like this: <input type="button" onclick="$('#form1').submit();" value="Create" /> but the ASP.NET MVC 2 Model Validation doesn't work. ...

ASP MVC 2 unedited fields come back null

I have a Controller with two Edit methods (see below). When I submit the view, any property in quoteOption that is not posted back via an input control is empty. For example, in quoteOption I have quoteOptionID - which I don't display or make editable. That property is empty (set to 0) in quoteOptionToUpdate. If I add a textbox for Qu...

Bulk printing mechanism in asp.net mvc 1.0

I m new to asp.net MVC1.0.I need solution for bulk printing in my application.instead of clicking print button for each n every data of grid,i want the user to hit single print button for printing all the records of grid in bulk.plz tell me how should i proceed for this. ...

Asp.net MVC jQuery Ajax calls to JsonResult return no data

I have this script loaded on a page: (function() { window.alert('bookmarklet started'); function AjaxSuccess(data, textStatus, xmlHttpRequest) { if (typeof (data) == 'undefined') { return alert('Data is undefined'); } alert('ajax success' + (dat...

what is the best way to FTP deploy an asp.net mvc site

right now i am simply ftping everything (all of my source code included) but i figured there was a best practices way to get the right dlls and the right aspx files to deploy. ...

Any sensible way of executing an ASP.NET MVC view from NUnit?

I'm aware of things like Selenium and WatiR, but what I'd like to be able to do is to test that the view renders the HTML I expect when it's presented with given inputs. No javascript debugging, just checking the HTML. However, to do that, I need to be able to execute the view programmatically. Is there any reasonable way of doing thi...

Getting 'connection reset by server' error in asp.net mvc upload file code after submit.

I've read several questions explaining how to handle file uploads in asp.net mvc. I am trying to submit both the file as well as form fields describing it. That might be the issue. I'll go write to the code: View code: <% using (Html.BeginForm("CreateFile", "Video", FormMethod.Post, new { enctype = "multipart/form-data" })) {%> ...

Validation texbox in MVC

Hello I have the following code and i don't know were is the mistake [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(factura fac) { if (fac.numar>0) ModelState.AddModelError("numar", "Numar este invalid ."); if (fac.serie.Trim().Length == 0) ModelState.AddModelError("serie", "...

How to generate a pop up page link in ASP.NET MVC

How to generate a javascript link in asp.net mvc? eg. <a href="javascript:poptastic('/examples/poppedexample.html');">Pop it</a> Can I use Html.ActionLink and how to do this? I could do something like this: <a href="javascript:poptastic('ItemDetail?ID=<%=item.ID%>');">Pop it</a> But I just want to find out will there be some...

How to get variables from JavaScript to ASP.NET (MVC)

I'm using ASP.NET MVC (I'm really new to both asp.net and the asp.net mvc type projects, but trying hard to learn). I've set up MVC with a controller so that it runs a C#.net method which; queries an mssql db converts it to json returns the json string It's called from the javascript by requesting an url with a parameter. But what ...

ASP.NET MVC View for data classes that have the same base class

I have an Edit page that has the base class as the data class, and it would show different editor form depending on which derived class the model is. However, after posting [HttpPost] public ActionResult Edit(BaseClassModel model) the model here only holds values for the base class and cannot be cast back to the derived class. How ca...

ASP.NET MVC - Populate a drop down list

Hello, I'm new to ASP.NET MVC. I'm trying to figure out how create a basic drop down list from values in my database. In ASP.NET web forms, I know I can load a drop down list like this: Page.aspx <asp:DropDownList ID="myDropDownList" runat="server" DataTextField="FullName" DataValueField="ID" OnLoad="myDropDownList_Load" /> Page.asp...

Visual Studio cannot find the EntityModelCodeGenerator custom tool

Hello all, I'm helping develop a MVC application in Visual Studio 2008 using the Entity Model Framework. I've gotten the code from the source control and I'm wanting to add some new Models from the edmx file. I right click and then click "Custom Tool" but then I get the following error. Cannot find custom tool 'EntityModelCodeGenerat...

What is the correct url for checking out AutoMapper from googlecode?

I am referring to this project by Jimmy Bogard: http://www.codeplex.com/AutoMapper The code repository site is: http://code.google.com/p/automapperhome/source/checkout The instructed checkout command is: svn checkout http://automapperhome.googlecode.com/svn/trunk/ automapperhome-read-only This does not work. I have tried SlikSVN, To...

ASP.NET MVC - ModelState.IsValid is false, - how to bypass?

I have a small application where i an creating a customer [Authorize] [AcceptVerbs(HttpVerbs.Post)] public ActionResult CreateCustomer(GWCustomer customer) { if (string.IsNullOrEmpty(customer.CustomerName)) { ModelState.AddModelError("CustomerName", "The name cannot be empty"); } ....

Asp.net MVC Form Post to Action with missing parameter initialization

I am having trouble with an ASP.net MVC form Posting to an Action containing multiple parameters. The problem is only some of the parameters are being initialized. The page has multiple forms each backed by a separate controller. The controller action receiving the Post action looks like this public ActionResult Create(int institution...

asp.net mvc ajax EnableClientValidation and parse returned data

i use ajax.beginform with EnableClientValidation. problem -the form sends data to controller in any case even the form is not correct -what the proiblem? the second qusion- i return ajax data like this return Json(new { value = "msg" }); how can i parse this data from javascript on view? ...

ASP.NET MVC - Dynamic Authorization

I am building a simple cms in which roles are set dynamically in the admin panel. therefore the existing way of authorizing a controller method - [[Authorize(Roles=”admin”)] for example, is no longer sufficient. The role - action relationship must be stored in the database, so that end users could could easily give/take permissions to ot...

ASP.NET MVC and SQL Server

I am new to ASP.NET and the MVC framework as well, so I'd love it if someone could recommend and/or show me some examples of code on how to best read a table from a database and store it as json. The goal after that is to receive some query filter options from a javascript, and then output the json-ified table back to the javascript. Th...

Best way of implementing DropDownList in ASP.NET MVC 2?

I am trying to understand the best way of implementing a DropDownList in ASP.NET MVC 2 using the DropDownListFor helper. This is a multi-part question. First, what is the best way to pass the list data to the view? Pass the list in your model with a SelectList property that contains the data Pass the list in via ViewData How do I g...