asp.net-mvc

Drawbacks of WebFormsMVP?

While ASP.NET MVC seems to be a viable technology praised by a lot of developers, I can't seem to find enough reasons to devote my energy and time for it. The main reason is that I don't find enough .NET jobs asking for it. Companies still use WebForms and it works just fine for them. I am not self employed where I get to choose the tech...

jquery validation problems

to custom validate an input i wrote a script: function cardNumberCheck(value, element) { var res = false; $.get("/CaseHistories/ValidateCardNumber", { caseHistoryId: $('#CaseHistory_Id').val(), cardNumber: $('#CaseHistory_CardNumber').val() }, function(data) { res = data }); //alert(res) => works fine return t...

jquery ajax request is Forbidden in IE. How to fix (any workaround)?

<script type="text/javascript"> $(function () { $("select#oblast").change(function () { var oblast_id = $("#oblast > option:selected").attr("value"); $("#Rayondiv").hide(); $.ajax({ type: "GET", contentType: "application/json", ...

How to modify MapRoute (add new dir)

How can I change my map route so I can have another dir, and not just the controllers and actions. What I want is to have another directory before the controller so that way I can separate controller per "module" routes.MapRoute( "Default", // Route name "{module}/{c...

Using the Callback Method on a View in ASP.NET MVC

I have a master page with that code: public string CallbackMethod; protected void Page_Load(object sender, EventArgs e) { CallbackMethod = Page.ClientScript.GetCallbackEventReference(this, "message", "Dodanie", "context", true); } /other code here/ then, in the View (which is bas...

How to port an Ajax CMS based on metadata in Asp.Net MVC?

I'm maintaining a CMS where I have this feeling it was made in the age of dinosaurs (Asp.net 1.0?) and decided to upgrade it with Asp.Net MVC and jQuery. But I have some problems regarding the design/specifications of the CMS which I cannot change. The CMS The CMS uses JavaScript. Alot. As in "I don't load pages, I request new pages u...

Passing a list of object from a view to the controller in asp.net mvc?

Is this possible? What I want to do is pass a list of objects as a paramter in an actionlink At the moment when I try to do this the list is always empty by the time it reaches the controller! In the view <%= Url.Action("ActionName", new { list = Model.ListOfObjects}) %> In the controller public ActionResult ActionName(List<Object>...

Can PHP array passed POST method to catch in ASP.NET MVC?

Can PHP array passed POST method to catch in ASP.NET MVC? Query string: WebAccess/ArrayTest?val[]=1&val[]=2&val[]=3 I write: ActionResult ArrayTest (String[] val) But this only works if the query string to remove the "[]" ...

How to use RegularExpression DataAnnotation with Resource file

Hi, I am currently using MVC 1.0 and .NET 3.5. I am using DataAnnotations to validate my model. I'm trying to add use the RegularExpression to validate a Postcode. I have stored my Regex in the resource file as many models will use it, when I try the following: [RegularExpression(Resources.RegexPostcode, ErrorMessage="Postcode form...

Authorization and Jquery dialog problem.

Hi, I have a little problem with a Jquery dialog for an action that requires a role. In my example, the user can click on a delete button and must confirm the action. In my controller, the Delete action requires a role, if the user is in the required role, the object is deleted. The problem: How to alert the user if * the element was d...

What is wrong with my Basic Authentication in my Browser?

Hi folks, i'm trying to goto the following url :- http://user1:pass1@localhost:1234/api/users?format=xml nothing to complex. Notice how i've got the username/password in the url? this, i believe, is for basic authentication. When I do that, the Request Headers are MISSING the 'Authorize' header. Er... that's not right :( I have ...

Reject (Hard 404) ASP.NET MVC-style URLs

Hi, ASP.NET MVC web app that exposes "friendly" URLs: http://somesite.com/friendlyurl ...which are rewritten (not redirected) to ASP.NET MVC-style URLs under the hood: http://somesite.com/Controller/Action The user never actually sees any ASP.NET MVC style URLS. If he requests one, we hard 404 it. ASP.NET MVC is (in this app) an i...

.Ajax with jQuery and MVC2

Im trying to create an ajax (post) event that will populate a table in a div on button click. I have a list of groups, when you click on a group, I would like the table to "disappear" and the members that belong to that group to "appear". My problem comes up when using jQuery's .ajax... When I click on the button, it is looking for a...

What is the JavaScript variable scope in a switch / case statment?

While creating JavaScript with ASP.NET MVC I noticed several scope warnings and realized that I am missing something with understanding the variable scope inside the switch / case statement. Warning: 'i' is already defined referring to case b and case c My code looks similar to this: switch(element) { case 'a': for(var i=0; i < c...

How do I populate a dropdown list on an ascx view user control MVC?

I have a drop down list hardcoded in a MVC View User Control page and would like to populate this from a database table. The MVC View page Inherits data coming in from my controller. This drop down list would contain something like a list of states for the user to choose to set an item for my main object. This list would not fit into th...

C# newbie problem part 2 - declaring class and method

[AcceptVerbs(HttpVerbs.Post)] public ActionResult Upload(Photo photo) { foreach (string file in Request.Files) { var path = "~/Uploads/Photos/"; HttpPostedFileBase posted = (HttpPostedFileBase)Request.Files[file]; if (posted.ContentLength > 0) { photo.Date = DateTime.Now; ...

How to force a refresh of possibly cached value?

I have the following Repository: Public Class PageRepository Private Shared _pages As BLL.PageCollection Shared Function AllPages() As BLL.PageCollection If _pages Is Nothing Then _pages = new BLL.PageCollection(LOADALL) Return _pages End Function End Class I do all selects using LINQ on the PageRepository...

How do I correctly Re-render a Recaptcha in ASP.NET MVC 2 after an AJAX POST

Ok... I've downloaded and implemented this Recaptcha implementation for MVC which uses the ModelState to confirm the validity of the captcha control. It works brilliantly... except when I start to use it in an AJAX Form. In a nutshell, when a div is re-rendered with AJAX, the ReCaptcha that it should contain does not appear, even tho...

Creating a new record using AJAX in ASP.NET-MVC

I am having the hardest time wrapping my head around this. I recently asked this question Create/Edit/Save data in a jQuery pop-up for ASP.NET-MVC and Linq2Sql I'm sure that the response is the right way to go, but I just can't figure out how to write the back-end code to make it work. I originally made my site by following the nerddi...

ASP.NET MVC Ajax: Error with Ajax.Actionlink ('b.apply' is not a function in MicrosoftAjax.js)

Hello, I made some changes to my ajax test website and now my Ajax.ActionLinks don't work anymore! The ActionLinks in question are made like this: <%=Ajax.ActionLink("Language Select", "LanguageScreen", "Home", from("LanguageScreen", "Functions"), meep("LanguageScreen", "Functions"))%>` The "from" and "meep" functions are only one li...