asp.net-mvc

What happened to filterContext.Cancel (ASP.NET MVC)

Before RC1 we did something like this: public void OnAuthorization(AuthorizationContext filterContext) { if (whatever) { filterContext.Cancel(); } } This is gone now, how do we achieve the same results with RC1? Thanks, Kyle ...

ASP.NET MVC dropdown with a default empty option

Is there a way to include a default empty option (or with text) if there is no selected value for a dropdownlist? ...

Abstracting the interpretation of MVC checkboxes values received by the FormsCollection object

In ASP.NET MVC a checkbox is generated by the HtmlHelper code here: <%= Html.CheckBox("List_" + mailingList.Key, true) %> as this HTML: <input id="List_NEW_PRODUCTS" name="List_NEW_PRODUCTS" type="checkbox" value="true" /> <input name="List_NEW_PRODUCTS" type="hidden" value="false" /> In case you're wondering why is there an extra ...

Are there any cms system in asp.net mvc like drupal

Hi everybody I'm new to asp.net mvc world. Are there any cms system based on asp.net mvc like drupal (php, cms, plugin modules). I dont like dotnetnuke because they use webform and difficult to extends. thanks ...

MVC Bulk Edit - Linq to Sql List Save

To get my head round some fundamentals using MVC and Linq to SQL I'm working on an adaption to Stephen Walther's TaskList application: I'm adding a Bulk Edit system using the concepts described in Steve Sanderson's blog. This all works as expected, however, I'm having trouble saving my returned List of Tasks. The Post to my BulkEdit lo...

Equivalent of html.actionlink to be called in the controller?

I am setting my header tag from the controller: ViewData["H1"] = "Home > " + category + " > " + subcategory; I would like Home and category to be urls, what is the best way to go about doing that? ...

add to TempData from non controller class

How do I add to the TempData dictionary from a non controller class? ...

MVC Bulk Edit - Examples

Ok, so this is an alternative to this question. I'm trying to produce an MVC application using LinqToSql that allows for bulk editing of data on a single page. Imagine a simple table Item with ItemId, ItemName, ItemPrice as fields. There are many examples out there of extrmely simple MVC applications that show you a list of these item...

Return View from ActionFilter

I have an ActionFilter that checks if a parameter in the URL is valid. If it is not valid I have to render a View. I dont want to redirect, because I still need the ActionExecutingContext. Can that be done? public override void OnActionExecuting(ActionExecutingContext filterContext) { Guid processIdentifier = (Guid)filt...

MVC general class location

In the MVC folder structure, where should general class files reside? For example, I have a class that determines the right DataContext to use, so I'm not reinventing the wheel in each of my controllers. Should it live in the Controllers folder even though it's not a controller? Should it be with the Models because it's database related,...

ASP.NET MVC RC ajax problem onsubmit

The problem with onsubmit still continues when I even use preventDefault option. My problem is the same with Asp.net mvc beta ajax problem <% using (this.Ajax.BeginForm("den2", "Deneme", null, new AjaxOptions { Up...

Use Sys.Services.RoleService with ASP.NET MVC

Has anyone successfully used the Microsoft Ajax libraries (Specifically Sys.Services.RoleService) with an ASP.NET MVC application? I can't figure out how to go about using the RoleService without using the ScriptManager and a server-side control (which seems to throw off my other Ajax calls). ...

Updating a disconnected LINQ object with MVC Framework RC1

This is a little out there but I have a customer object coming back to my controller. I want to just reconnect this object back to the database, is it even possible? I know there is a datacontext.customers.insertonsubmit(customer), but is there the equivalent datacontext.customers.updateonsubmit(customer)??? ...

System.Web.Routing with WebForms - picking up variables in the target page

I have the pattern User/{domain}/{username} set up via Routing. Everything works except for one thing. I can't figure out how to get the domain and username variables passed to my redirected page. Below is my GetHttpHandler method from my IRouteHandler implementation. public IHttpHandler GetHttpHandler(RequestContext requestContext)...

Ajax.BeginForm refresh partial..?

Okay so, I have a form that is posting using ajax... <% using(Ajax.BeginForm(new AjaxOptions() { OnBegin="onBegin", OnSuccess = "onSuccess", OnFailure="onFailure" })) { %> On the server side I am passing back from the controller a Json object. Now, when the OnSuccess event fires I can get to the Json object by using "result.get_respo...

Where is Html.Image in ASP .NET MVC RC?

I can't find the Html.Image method in new MVC RC version. Please somebody give me example how to render simple Image in ASP .NET MVC RC sites. ...

Which is faster asp.net mvc json or json.net?

I was wondering if anyone has run any benchmark tests on the JSON() function in Asp.net MVC and how it compares to JSON.NET? Also which one outputs the best json strings? ...

Naming conventions in MVC partial views to avoid ID collisions

Anyone coming from ASP.NET (pre-MVC) has become accustomed to being able to give their controls whatever IDs they want. You can create a field called Email in an .asmx file, a field called Email in your main page, a field called Email in your master page, place multiple instances of your .asmx file on the page and they'll all get their o...

ASP.Net MVC RC1 RouteCollection.MapRoute Problem

I have a problem with the RC1 version of ASP.Net MVC. Whenever I add a Route before the "Default" route, the resulting Urls created are for the first Route added. Here is my Routing in Global.asax.cs routes.MapRoute( "product-detailed", "Products/{controller}/{action}/{id}", new { controller = "Produ...

How should I implement user membership in my ASP.NET MVC site?

I'm creating an ASP.NET MVC site and I need to implement login and membership functionality. Is this something where I roll my own? I already have a members table in my database, should I create a username and password hash field and just check against it? What about keeping the user logged in with a cookie that expires? Is this a...