asp.net-mvc

multiple file upload control in mvc application

hello All, I am having multiple file upload control in my mvc application please tell me how shall I do the functionality? The files must get inserted into database at once . Please tell me how shall I do? If anyone one has ready code please post it Thanks Ritz ...

Handling System.Web.HttpException

Any request to a non existent file or folder is throwing the following exception on my MVC project; System.Web.HttpException: The controller for path ... could not be found or it does not implement IController Important Edit: I would like to handle this case so that this exception does not go into my Elmah logs. Whatever I do inside ...

Implementing Finite State Machine for Web UI

I am intending to develop a Finite State Machine in the following manner. Extract Control IDs from a --> web-page, Write control IDs to a XML --> Controls-XML. Manually declare States and Transition in the --> Controls-XML Scan Controls-XML and attach pre-declared Jscript to eventhandlers embed them in the --> web-page.. 5. How feas...

Making mvccontrib testhelper work with actions that get route data automapped to objects

This is ASP.NET MVC v1 (not using the v2 yet) I have a route entry like this: routes.MapRoute( "Srp", "soeg-{searchQuery}/{listingType}", new { controller = "Srp", action = "Search", listingType = string.Empty }, new { listingType = "privat|forhandler|"} ); and a...

Why seems any kind of abstraction to be solved with interfaces instead of abstract classes?

Heyho, There´s a question in my mind for some time now, which hopefully can be cleared quickly by some of you: I am a big fan of MVC, ASP.Net Mvc in my case. What I have noticed is the hype about interfaces. Every video, tutorial and book seems to solve any kind of abstraction with interfaces. I have adapted these patterns, understoo...

ASP.NET (MVC) Outputcache and concurrent requests

Let's say that, theoratically, I have a page / controller action in my website that does some very heavy stuff. It takes about 10 seconds to complete it's operation. Now, I use .NET's outputcache mechanism to cache it for 15 minutes (for examle, I use [OutputCache(Duration = 900)]) What happens if, after 15 minutes, the cache is expired...

Can't explain why not redirecting after login using RedirectFromLogin

I am using ASP.NET MVC, on my login action I am doing: [AcceptVerbs("POST")] public ActionResult Login(FormCollection form) { User validatedUser = // tests username/pwd here. FormsAuthentication.RedirectFromLoginPage( validatedUser.ID.ToString(), rememberMe); if(String.IsNullOrEmpty(Request["ReturnUrl"])) s...

Why is the call to Request.QueryString["ReturnUrl"] returning NULL? It is present in the URL?

(This is a more narrow question) In my asp.net MVC action, I am looking if the ReturnUrl value is in the URL. My Url looks like this: http://localhost:56112/user/login?ReturnUrl=/user/settings In my action, I am looking if that querystring value exists, and it is returning NULL?? How can this be? The code: if(Request.QueryString["...

Using a Modifing a Radix Tree for implementing a URL matching algorithm

I am refactoring this algorithm completely. Basically I am re-implementing the ASP.NET MVC in C++ for another framework. I'm trying to implement a URL matching algorithm and I figured that radix tree would be the best choice for the keys searching because some url prefixes might be shared. Also searching may be very efficient considerin...

dropdown question

What is wrong with this ? <%=Html.DropDownListFor(m=>m.Client,null,"Select",new { @style = "width: 630px" })%> There is a ViewData["Client"] which contanins the source , the dropdown is filled but is not selected the value corresponding to Model.Client ...

read only Textbox in ASP.net MVC View

Hi How to set the readonly attribute to HTML Textbox helper class. <%= Html.TextBox("Email", "[email protected]", new { @class = "required email" } )%> Appreciate your response Thanks ...

How to set the default selected value of Dropdown on ASP.NET MVC View page

Hi I have a dropdown that i need to set the default selected value from the database. Example: <%= Html.DropDownList("state", " -- Select one -- ")%> The above code binds records from the ViewData["specialty"] from my entity model. And "Select One" is added on the top. Now if i need my dropdown to set the default value to 'NY'. How...

Handling tables of different types in ASP.NET MVC

I am designing a database for an ASP.NET MVC application. I'm an expert in neither, and I'm curious what the best approach would be for the following database snippet: We will be storing Events in our database. Each event will be of a different type with various fields exclusive to one or some of the types. An example: Events * Id *...

Best way to transfer an Entity Framework object over the web and back via JSON

I've got some MVC code that serializes an EF 3.5 object into an anonymous type for return as a JSON result to an AJAX call on my page. The hurdle I have is that when I send the object back to the server via JSON, (and let the ModelBinder deserialize it for me into my EF type), I have to update it in my Entity Framework context manually....

Entity Framework, AutoMapper, handling entity updates

I just started using the Entity Framework 1.0 recently and believe I am beginning to feel the pains everyone is talking about. I'm trying to use best practices so I have a set of DTO that get mapped to and from my Entities via AutoMapper. The real catch is when I'm trying to update an object. The first gotcha was that I could not find ...

Html table, where each row has a checkbox, want to send all checkbox value's to an ajax call

I have a report page, that displays many rows, each row having its own checkbox with its value being an ID field from the database. This is for a bulk operation, that will be preformed on all the row's where the checkbox was checked. So if the user checks multiple boxes, hits a button, I need to send all the checkbox values to a contro...

asp.net mvc and valid xhtml?

For some reason an html helper is outputting this html which doesnt validate. the validator tells me There is no attribute "Length" <%= Html.CheckBox("Medicamentos", Model.Medicamentos) %> is outputting <input type="checkbox" value="true" name="Medicamentos" id="Medicamentos" checked="checked" length="4"> ...

Setting CultureInfo in Tests project?

I've got an MVC app that I've set the globalization in the web.config. All is well in the web app. But in my tests project I'm getting an issue in my service layer. I'm asking for date of birth in the following format dd/MM/yyyy. I'm passing this as a string to my service layer. I've got a RegEx to check that it is formatted correctly bu...

Anyone have an example of RESTful URL's in ASP.NET MVC 2 RC that works?

I have tried the code here: http://dotnetslackers.com/articles/aspnet/Implementing-RESTful-Routes-and-Controllers-in-ASP-NET-MVC-2-0.aspx#s-reststyle-routes--controllers But I just cannot get this to work with ASP.NET MVC 2.0 RC - the PUT and DELETE verbs do not get used. The output seems right, but the route handler seems to ignore t...

Visual Studio 2008 Hangs in an ASP.NET MVC View

I'm working on an existing ASP.NET MVC 1 application in Visual Studio 2008. When I open a view about 10-20 seconds later I can't set the focus into Visual Studio. When I click with the mouse I get a system ding. Mouse wheel will scroll the source code window. Keyboard doesn't work, but the cursor is flashing. Doing a few SO searches I f...