asp.net-mvc

asp.net mvc is Session available at any point durign controller construction?

hi, i am trying to access Session variables in the constructor of a controller and ControllerContext it seems is always null. When is the earliest the session variables are available? thanks! Edit: Example: in one controller: public HomeController() { MyClass test = (MyClass)ControllerContext.HttpContext.Session["Sess...

ASP.NET MVC: Localization issues (wrong resx file for culture)

I have a Strings.resx and a Strings.nl.resx file. The first contains a English string, the other a Dutch string. They are part of a C# Class Library project: Module. public static string testString() { //I Force the culture to always be english Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("...

mvc2 migration issue

i migrate my mvc1 project to mvc2. my jquery json result function does not work anymore. have any idea ? aspx $.getJSON('Customer/GetWarningList/0', function(jsonResult) { $.each(jsonResult, function(i, val) { $('#LastUpdates').prepend(jsonResult[i].Url); }); ...

Generate ActionLink/RouteLink from Paging UserControl that uses the current routevalues and modelstate

I'm implementing a site which has a search that can be executed via Controller methods that are accessed from two different routes. One hangs off the default route (using either Post data or query string values for the search parameters) and one is an SEO optimisation url which takes a location and phrase via two route values. The seco...

ASP.NET MVC, Spring.NET, NHibernate initial setup/example/tutorial.

Hello! Have you been doing some ASP.NET MVC developement involving Spring.NET and NHibernate both? I would like to see an informative example of such setup, so I could build my own project off that. I tried googling, found some pretty things like S#arp Architecture, an article about regular ASP.NET (WebForms) integrated with the framew...

Maintaining ViewModel fields with default model binding and failed validation

I have an ASP.Net MVC Controller with a 'MapColumns' action along with a corresponding ViewModel and View. I'm using the defaultModelBinder to bind a number of drop down lists to a Dictionary in the ViewModel. The view model also contains an IList field for both source and destination columns which are used to render the view. My quest...

XSLT and MVC Certification

Hello, I want to learn xslt and also asp.net mvc, but I'd like to have an exam so I can get a certification. Are there exams for xslt or mvc from Microsoft or from another company? Thanks. ...

How can I toggle the display for multiple rows using a ddl onchange()? (JQuery or javascript)

The javascript code I now have can toggle a single row of data. Whether JQuery or javascript, how do I toggle multiple rows? In this example, when location 1 (value = "1") is selected, I would like to have tr tags "11", "12", "13" displayed (Location "1" Building "1" => "11")and Location 2 displays tr "21", "22". <script type="text...

How to handle null {id} on route?

What if a user hits my site with http://www.mysite.com/Quote/Edit rather than http://www.mysite.com/Quote/Edit/1000 In other words, they do not specify a value for {id}. If they do not, I want to display a nice "Not Found" page, since they did not give an ID. I currentl handle this by accepting a nullable int as the parameter in the Con...

Using GET instead of POST to delete data behind authenticated pages

I know you should use POST whenever data will be modified on a public website. There are several reasons including the fact that search engines will follow all the links and modify the data. My question is do you think it is OK to use GET behind authenticated pages in something like an admin interface? One example would be a list of pr...

Custom RoleProvider with MVC 2.0 webconfig

I have a custom MembershipProvider and a custom RoleProvider. I created the custom MembershipProvider by creating a SimpleMembershipProvider class which implements the MembershipProvider class. After that I changed my web.config and works. So I used the same approach creating a custom RoleProvider. Nothing special, just creating a Sim...

how to go other page on dropdown selection using asp.net mvc

hello friends I haev a dropdownlist box on my page.. with A B C D E F each pages have difernt images once If I select A I need display one Image like B I need to display other image/table on the page.. can any one tel me how to do this? thanks for all your time ...

jquey ajax upload file in asp.net mvc

i have a file in my view <form id="upload" enctype="multipart/form-data"> <input type="file" name="fileUpload" id="fileUpload" size="23" /><br /> </form> and an ajax request $.ajax({ url: '<%=Url.Action("JsonSave","Survey") %>', dataType: 'json', processData: false, con...

how to create a class diagram relations in asp.net mvc

I am created class diagram in asp.net mvc. I drag and droped some of the classes in the classdiagram.. now I am seeing all my classes.. I have two questions here 1) in the class diagram window I need to show property and property defincation ex: Name string ID int something like this 2) how to give the relation to...

Html.ActionLink in Partial View

Hi. I am using the following code in my master page: <% Html.RenderAction("RecentArticles","Article"); %> where the RecentArticles Action (in ArticleController) is : [ChildActionOnly] public ActionResult RecentArticles() { var viewData = articleRepository.GetRecentArticles(3); return PartialView(viewData); ...

Unit testing an MVC action method with a Cache dependency?

I’m relatively new to testing and MVC and came across a sticking point today. I’m attempting to test an action method that has a dependency on HttpContext.Current.Cache and wanted to know the best practice for achieving the “low coupling” to allow for easy testing. Here's what I've got so far... public class CacheHandler : ICacheHan...

How do I organize an asp.NET MVC project to allow for a "lite" version

I am migrating an web forms app to ASP.NET MVC. Down the road we may want to offer a "lite" version of this application. This is a pretty vague concept, but I expect the underlying database would be the same, we would only simplify the UI, and users might even switch at will between the full and lite versions. We would obviously want ...

ASP.NET MVC and User Authentication with NHibernate

I am about to start a new application and am excited about using asp.net mvc and nhibernate. However, the big "problem" is how I handle the user authentication stuff. What are some ways those used to using nhibernate and MVC solve this problem? My thought is let asp.net do its own thing and I do my own thing database wise. Am curios if ...

ValidationAttribute + Ajax trouble

I tried to make ValidationAttribute which would check the database whether such an object. And it even works only if you do not include <% Html.EnableClientValidation ();%> Can Someone tells how to get to work through Ajax public class UsernameBaseCheckAttribute : ValidationAttribute { SimplebdLinqDataContext db = new SimplebdLin...

Geting SelectList to MVC view using AJAX/jQuery

Hi all. I have a C# MVC application which is populating a dropdown based on a date selected. Once the date is selected I am sending it to an action via AJAX/jQuery. The action gets a list of items to return for that date. Here is where my problem is. I have done it previously where I render a partial view from the action and pass it th...