asp.net-mvc

How to implement a Client-side Ajax Login on Asp.Net MVC (A link to the solution for Asp.Net Webforms is in here)

Hi, I'm trying to implement a client-side ajax login on Asp.Net MVC. I used to have this set up just fine on WebForms, but now that I've moved to MVC it's giving me some troubles. If you'd like a tutorial on Client-side Ajax Login for Asp.Net Webforms, it can be found here -- Easy, A++ Now... for some reason it's not working for Asp.N...

How to process JSON using jquery?

I have a controller that returns a list of custom linq-to-sql model objects in JSON format to jquery ajax calls: List<MyAppLibrary.Model.Search> listSearches = search.ToList(); return new JsonResult { Data = listSearches }; I have the following javascript which gets the response: $.getJSON("/ajax/getbrands", function(data...

How to get value in a dialog box to Mvc controller ???

My Dialog Box is an jquery Dialog Box, my popup use <%Html.RenderPartial("MyUC")%> to call an usercontroll for Markup for a Dialog Box. How to the controller can call the value in Dialog Box ...

ASP.NET MVC: Tabs ASCX - Adjust CSS class based on current page?

Hello, I have an ASP.NET MVC application and I'm trying to implement tabs which will navigate to different pages. The tabs are implemented as a simple ASCX usercontrol, e.g. <ul> <li><a href="xyz1.html>Number One</a></li> <li class="activePage"><a href="xyz2.html>Number Two</a></li> <li><a href="xyz1.html>Number Three</a><...

Front-end developer in a .NET world - What do I need to know?

When working on the front-end of a .NET application what are the basic prerequisites? What do I need to know in order to survive, assuming I already have knowledge of HTML/CSS/JavaScript plus a general awareness of the MVC pattern and how it works. Is there anything else? ...

Link Helper Class in ASP.Net MVC; Where is the URL-Encode?

To get the URL's I wanted i created a simple Link Creator helper for my search results. But it wont let me use server urlencode in it and some of the details passed are French/Czech/Swedish words commas and apostrophes; Is there a quick function that will strip all this garbage out before hand? ...

escape apostrophes in Linq based stored procedure calls when SP contains dynamic SQL

Hi guys, I noticed the following: An ASP.NET MVC website under development gets an SQL error "Unclosed quotation mark ..." when it makes a LINQ call to a stored procedure that contains dynamic SQL. For example: SP GetEmployees called with parameter [filter_name] that has value [n'for] throws this error I can fix the problem by doing...

ASP.NET MVC deployment to IIS 5/6 with Virtual Directory

Hi All, I have an asp.net MVC App that I want to deploy to IIS 5 and/or 6 using a Virtual Directory. I have already performed the wildcard routing, but I have a problem with relative paths. Imagine I have created a virtual directory called myApp. After deploying I can go to http://localhost/myApp and am greeted by the index page. My...

Thoughts about asp.net mvc 2 preview 1

Hi, I'm interested what you think about preview 1 release of asp.net mvc2 ? Especially about input helpers? Do you think they would do their job better than Eric Hexter input buliders ?f I'm interested especially in input builders becouse I don't know which to use in my next project and input builders from mvc2 are the only feature impor...

change an ASP.NET variable after someone clicks on a link

Hi, I want to change an ASP.NET variable when someone clicks on a link on the page. Specifically a Session["something"] variable. That means I should do it after postback, but I am new to whole web development and the ASP.NET MVC specifically, so I know just an overloaded action with some [Accept] attribute. Since this link is on the mas...

MVC 2 preview 1 - methods with parameters in the controller fail to load

Plenty of pages load since upgrading my site from MVC 1.0 but if I go to a page that uses a querystring then I get this error: [EntryPointNotFoundException: Entry point was not found.] System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +219 System.Web.Mv...

asp.net-mvc textbox validation

i am using the sample asp.net mvc app and i want to add specific validation on certain textboxes such as: No spaces Min / Max size how would i go about doing this? ...

Including script reference from HtmlHelper extension method

Here sample extension method for calendar rendering: public static string Calendar(this HtmlHelper html) { return "<input type='text' onclick='showCalendar(this)'/>"; } Function showCalendar() defined in calendar.js. Is it possible to register reference to calendar.js from an extension method? Html.Calendar() can be called more ...

Get ControllerName and ActionName and populate the ViewData in Master Page?

I've a SuperController which will be inherited from all the controllers. In the constructor I'm trying to populate the ViewData using the ControllerName and the ActionName. I'm not going to pass the ControllerName and the ActionName as the ViewData. I've a method that needs the ControllerName and the ActionName and I need to pass the re...

asp.net-mvc - how do i create a view to show all unapproved users and allow them to be approved

i have this code in my membership service class (taken from the asp.net-mvc sample app) public MembershipUserCollection GetUnapprovedUsers() { MembershipUserCollection users = Membership.GetAllUsers(); MembershipUserCollection unapprovedUsers = new MembershipUserCollection(); foreach (MembershipUser u in us...

Is it possible to override an attribute which has been applied at controller level on a specific method?

Hi, If I've applied an authorisation attribute at controller level, is it possible to override this on one of the methods on that controller? Thanks James ...

How do I store a hash with the search results?

I'm pulling 500 results from a search query to a webservice; I store these in the session for that user so pagnation doesnt cause further calls. What I want to do is stick the parameters together into one long string and hash them so I have a quick hash to check against. in php this would look something like... <?php $_SESSION["shash"...

How can I tell if there are validation errors from within my asp.net mvc View?

My layout is much simplified if I can only render parts of it when I need to display my validation summary. The problem is that you can't use IsValid as it will throw if accessed before validation has occurred. ViewData.ModelState.IsValid is false by default, so that won't work. The only thing I've found that works is <%if (this.View...

ASP.NET MVC Validation throws NullReferenceException against empty listbox.

I have two listboxes, one for available servers and one for selected servers. A user moves items from the first box to the second to indicate their selection. <table id="ServerLists" style="width: 100%;"> <tr> <td style="width: 40%;"> <%=Html.ListBox("AvailableServerList", Model.AvailableServerList, New With {.size = 8, .on...

How can I implement a "Select All" checkbox in my ASP.NET MVC app?

I have a table with a column full of checkboxes. At the top I would like to have a single "Select All" checkbox that would check all the checkboxes on that page. How should I implement this? I'm using jQuery as my JavaScript framework if it matters. ...