asp.net-mvc

Help required in user control

I am using a user control (.ascx) as below <div class="ui-widget" id="w_instruction"> <div class="ui-state-instruction ui-corner-all w-msg"> <a id="btn_instruction_close" class="ui-dialog-titlebar-close ui-corner-all" href="#" style="float:right;"><img src="../../Images/i_close_blue.png" border="0"/></a> ...

Resource not found when calling ActionResult from Controller from multiple submit buttons

link text I am following the answer in this link, I have done this... <% Html.BeginForm("MyAction", "MyController", FormMethod.Post); %> <input type="submit" name="submitButton" value="Send" /> <input type="submit" name="submitButton" value="Cancel" /> <% Html.EndForm(); %> <% Html.BeginForm("Send", "MyController", FormMethod.Post...

Post array to ASP.NET MVC 2 Controller using AJAX

Hello. There is known trouble with sending array to ASP.NET MVC controller. I've found a lot of solutions like that. Why don't use usual object instead array? It works good. Example of code: <script> $(function(){ $('.asArray').click(function(){ var array = Array(); array[0] = 'Dima'; ...

How to export data to excel using mvc without using third party control.

I want to export data to excel both in .xls and .xlsx format in asp.net MVC without using any third party control. I tried using following code but it doesn't support .xlsx format. Response.AddHeader("Content-Disposition", "attachment; filename=test.xlsx"); Response.ContentType = "application/ms-excel"; Response.Write(sw.ToString());...

Help with asp.net MVC routing and areas

I have the following controller, inside an area called "Service": namespace Web.Areas.Service.Controllers { public class IntervalController : Controller { // // GET: /Service/Interval/ public JsonResult Monitor(String accountId, int datekey) { //... } } } The URL http:...

Encoding of URL paramaters

I got a page that is a callback page, when the user gets redirected to my page I hash the parameters and check if it is valid. My problem is when myParameter contains characters like å, ä and ö. If I change myParameter to "same value with åäö" in the controller, then it works. I believe it has something to do with encodings, and I have ...

how to redirect to the same route (from where the request came) in asp.net mvc

I'm posting a form from a partial view which is rendered via Html.RenderAction and I want after the form post to redirect to the same route from where the request came. public ActionResult Index() { return PartialView(); } [HttpPost] public ActionResult Index(FormModel input) { ... return //Redirect to the same route } ...

Using Html.RenderPartial() in ascx files

Hello, I try to use Html.RenderPartial in acsx file and and I've got error Compiler Error Message: CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named 'RenderPartial' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling...

asp.net mvc 2: set master page in WebFormViewEngine's FindView

Hey guys I got a problem with a custom ViewEngine. I try to overrite the FindView method to set the master view without having to define it in each and every view page. public override ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache) { if (string.IsNullOrEmpty(masterN...

Save entity with relationship in Entity Framework / ASP.NET MVC 2

I have been dealing with this for at least two days now. I don't have a book available to reference, and I cannot for the life of me find an explanation of how this is supposed to work. What I am trying to do is a simple operation: Load a create form populated with 3 dropdownlist elements which reference other tables Fill out the form...

MVC Deletemodal with extra options using jQuery

In MVC I made a jQuery modal asking me if i'm sure if i want to delete it, and then make a postback with $.post I use this for all my 'Index views', which are quite a lot. For most views, when I delete something, the row from the table is also delete with hide() now, for some views, things do not really get deleted, but they get 'inact...

asp.net mvc client side validation password field in firefox

Asp.net mvc 2 seems to not clear a required validation error for a password field in firefox. in both firefox and chrome: submit the form client side validation works and it says 'password is required' In chrome, I add a value to the password field and the client error is cleared. In firefox,I add a value to the password field and the ...

Is it possible to have area routes co-exist with non-area routes at the same time?

I have an existing project, and I want to intorduce Areas and keep my original code as it is. i.e /web/controllers /web/views .. /web/areas/new-area/ /web/areas/new-area/controllers .. Do I have to modify routing for this to work? i.e. default area is ""? ...

how to use AsyncController in MVC application using Ninject for DI ?

Does anyone know how to use an AsyncController in a mvc application that uses Ninject for DI? AsyncController works fine when i dont use ninject but i cant make them work together. I added following in my sitemodule but no go. Bind<IAsyncController>( ).To<AsyncController>( ).InSingletonScope( ); sorry for not explaining this in de...

How to make json array parsing work on the server side.

Hello, I have an action on my server side: public void Action(Container container) { } where container is: public class Container { public string[] Arr; } From the client side, I'm invoking this action in the way below: $.post("Controller/Action", { Arr: "abc" }, null, "json"); After this, the Arr in container contains one e...

ASP.NET MVC 2 Html.TextAreaFor not updating on Edit

I have a form that lets the user enter in some text. It will be longer than a few characters so I want to use a TextArea instead of a TextBox. The Html.TextBoxFor works without issue, and the Html.TextAreaFor works when I create the entry, but does not store the new value when I edit it and shows whatever the value was before I went to...

ASP.NET MVC Workshop

Hi guys! I am an MVC developer since ASP.NET MVC Preview 1 and my company chose me as an instructor for an MVC 2 workshop. The session will last for 3 hours and I have not yet decided about the contents of the workshop. What would you tell about MVC 2 in 3 hours to grab and keep the people's attention? Thanks. ...

What's the best way to implement a fulltext search for an ASP.NET MVC application?

I've built an ASP.NET MVC application with MVC 2.0 and Fluent NHibernate (hided behind repositories for some reasons). The application represents a quite complex domain with some different objects like users, messages, comments, files and appointments. Now I want to implement a fulltext search which is enabling the user to find easily a...

XMLHttpRequest different in IE8 vs. FireFox/Chrome

I'm having a problem similar to http://stackoverflow.com/questions/2721970/jquery-ajax-not-working-in-ie8-but-it-works-on-firefox-chrome, but with a different use case. I'm using the jQuery Form plug-in to handle a file upload to an ASP.NET MVC controller, which sends the file off for parsing and processing. If an Exception is thrown, ...

Why should I test my HTMLHelpers?

Is there any tangible value in unit testing your own htmlhelpers? Many of these things just spit out a bunch of html markup - there's little if no logic. So, do you just compare one big html string to another? I mean, some of these thing require you to look at the generated markup in a browser to verify it's the output you want. Seems a...