asp.net-mvc

Add form values to Ajax.ActionLink

How is it possible to get values from a Html form to an Ajax.ActionLink method like the example below. Instead of "id=Model.DinnerID" I need to get the values of two textboxes that is in a Html form block? <%= Ajax.ActionLink( "RSVP for this event", "Register", "RSVP", new { id=M...

A view having more than one form

Hi, I want to create a view that contains two forms with their submit buttons. on submitting form ajax update should happen. So how Html herlper class will help me? ...

ASP.NET AJAX vs jQuery in ASP.NET MVC

Which one is better to use in ASP.NET MVC? ...

How to implement Development and ProductionDatabase in ASP.NET MVC with Ado.NET Entity?

I have used Ruby on Rails with ActiveRecord, so I am quite used to switching to Production/Development database. I am wondering, how do people implement Development and Production Database difference in ASP.NET MVC (preferably with ado.net entity). I tried to have it by creating 2 entity datasets with the same name in a different nam...

ReturnUrl in ASP.NET MVC

I currently have a login link on my application that looks something like this: <a href="/login?ReturnUrl=" + <%= Request.RawUrl %>>Login</a> I want to handle the POST command on the login page in the controller action below: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Login(string returnUrl) { // Authenticate user ret...

How can I Unit-test the behaviour of the HandleError attribute for a controller method?

I'm trying to verify the behaviour of my ASP.Net MVC app when an unexpected error occurs. Specifically, I'm trying to verify that the user is directed to the error page I've defined for my app. The problem I'm encountering is that I'm not able to verify the behaviour of the controller method as expected. For my normal behaviour tests, I...

jquery $.post get string returned from method

i have a simple form on my page with a textbox and button that calls this javascript method onclick="Create();" and this is the function that is ran... function Create() { var txt = document.getElementById("longTxt").value; if (txt == "Insert Name") { alert("You must provide a name"); return; } var d...

"A value is required" for GUID and DateTime properties that are read/write on a class

I created a business object (plain old class with properties, nothing fancy), that has an empty constructor, and I am using it as a strong type in my View for /Member/Create (see code). This all works fine, I get the object "post back" from the Create View - and my method memberToCreate.Save() actually writes what it is supposed to, to ...

How to prevent auto filling posted values in asp.net mvc ajax form

Inside of an asp.net mvc partial view, I have an Ajax form that posts a value and replaces the contents of its parent container with another instance of the form. Index.aspx view: <div id="tags"> <% Html.RenderPartial("Tags", Model); %> </div> Tags.ascx partial view: <% using(Ajax.BeginForm("tag", new AjaxOptions { UpdateTarge...

Asp.Net MVC how to get view to generate PDF.

I would like to call an action on a controller. Have the controller get the data from the model. The view then runs and generates a PDF. The only example I have found is in an article by Lou http://whereslou.com/2009/04/12/returning-pdfs-from-an-aspnet-mvc-action. His code is very elegant. The view is using ITextSharp to generate...

How might a site like Stack Overflow pass user information around in ASP.NET MVC?

Basically, I log into my website using OpenId, very similar to what I am assuming SO does. When I get the information back, I throw it into a database and create my "Registered User". I set my AuthCookie: FormsAuthentication.SetAuthCookie(user.Profile.MyProfile.DisplayName, false); Then I can use this for the User Name. However, I ...

Authorization problem, FormsAuth and ASP.NET MVC

I have a pretty simple ASP.NET MVC Site Application. (MVC 1.0) I have NO authorization sections in my web.config because I use the [Authoize] attribute on my controllers. The default web.config for the server allows * for forms authentication, as expected. I have 2 existing Windows 2008 dedicated (hosted) servers. The site works well...

ASP.Net MVC Model Binding Returning Null Values

Given the following markup: <form method="post" action="/home/index"> Username: <%= Html.TextBox("UserName")%> Password: <%= Html.TextBox("Password")%> <input id="login" type="button" value="Login" /> <input id="Submit1" type="submit" value="submit" /> </form> Can you tell me why the model binding is not work...

MVC w/ JavaScript - trips route

See the exception I have a JS include in my master page and it seems to be tripping one of the routes every time. Is tripping this route: routes.MapRoute( "CatalogType", "Catalog/{group}/{type}/{index}/{browseSize}", new { controller = "Catalog" , action = "Types" , group = "" , type = "" , index = "" , browseSiz...

Cannot add Entity Data Model in Visual Studio

I am running Visual Studio 08 Team Edition with .NET Framwork 3.5 SP1 on WinXP. I am trying to add a Entity Data Model to my project, however, the option to add an "ADO.NET Entity Data Model" selection does not appear. To give you a visual, I am essentially following the directions here ( http://www.aspfree.com/c/a/ASP.NET/Introduction...

MVC - Implement members online functionality

Hi, I have an ASP.NET MVC app and I want to add to each page a list of members online. Actually add to Master page. Members belong to groups so I want to show all members in there groups. So what is the best way of doing this?? Eg On session start add to a collection that is in cache object and remove it on session end in Global.asax...

Can I have an MVC Action as a ServiceMethod for an AutoCompleteExtender?

Assuming Tools is my Controller, I specify '/Tools' in the ServicePath, and the action name 'GetToolsList' in the ServiceMethod. Can I fire an AutoCompleteExtender this way? How would I be able to pass the prefixText to the Action here? Or is it not possible? ...

ASP MVC Authorize all actions except a few

I have a controller and I would like to require Authorization for all actions by default except a couple. So in the example below all actions should require authentication except the Index. I don't want to decorate every action with the Authorize, I just want to override the default authorization in certain circumstances probably with a ...

How to add reports in MVC application?

In the add new item there is an option to add report and add report wizard. But I don't know how to work with that. Is there any blog or video available to learn that? ...

URL routes - registering problem

Hello All. I've been using ASP.NET MVC for a few weeks, looking screencast, reading tutorials and so on. It turns out to be very interesting technology for me and I started to experimenting with it. I wrote simple web application which simply gets data from one table and shows it. All works fine on my dev environment, but when I tried ...