asp.net-mvc-2

Nerd Dinner pagginated list - how do I add a linq orderby clause dynamicaly? ANYONE????

Hi, I have implemented nerd dinner method of paging- which works great. But I want to be able to dynamically be able to order by certian fields. How would I go about implementing this. Here is my code? Controller: PaginatedList<Classifieds_Ads> pageOfClassifieds = new PaginatedList<Classifieds_Ads>(classifiedsRepositry.GetClassified...

Modelbinder creates a foreign relationship unnecessary.. how to solve?

I have a Product entity that has a foreign key relationship to Manufacturer. I want to make it optional whether user adding a new product wants to set a manufacturer. In my create view I have, <%= Html.LabelFor(p => p.Manufacturer.Name) %> <%= Html.EditorFor(p => p.Manufacturer.Name) %> In create action, public ActionResult Create(P...

ASP.Net MVC2 Custom Templates Loading via Ajax and Model Updating

I have a view model with a collection of other objects in it. public ParentViewModel { public int Id { get; set; } public string Name { get; set; } public List<ChildViewModel> Child { get; set; } } public ChildViewModel { public int Id { get; set; } public string FirstName { get; set; } } In one of my views I pas...

Guidance on a better way to retain filtering options when using ASP.NET MVC 2

I have an ASP.NET MVC 2 application which in part allows a user to filter data and view that data in a JQGrid. Currently this consists of a controller which initialises my filter model and configures how I wish my grid to be displayed. This information is used by a view and a partial view to display the filter and the grid shell. I us...

Redirect to action and return View instead of Ajax Result

I implemented filter, which should redirect me to one page if some conditions aren't true, But this filter don't work with Ajax Requests, after redirect, javascript capture result and put whole View into html element. How can i Stop processing ajax request and redirect it to normal http request?? Thx in advance, ...

elmah on iis6 and 7.5 mvc2

I am trying to get elmah working on a remote web server and my local iis 7.5 server. The remote server is iis 6. Elmah works the visual studio 2010 development server. When you browse to a aspx page that doesn't exist, it logs it and shows it in the log. When I test the application on iis 6 and iis 7.5 I can get to the elmah log page but...

ASP.Net MVC checking role of user in aspnet memebership

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <% if (Request.IsAuthenticated) { %> Welcome <b><%= Html.Encode(Page.User.Identity.Name) %></b>! [ <%= Html.ActionLink("Log Off", "LogOff", "Account") %> ] <br /> <% if(User.IsInRole("Administrator")) { %> <br /> <%= Html.A...

How to enable/Disable textbox. and also make text box blank on change of value in the drop down list

Hi Users, I am using jquery to do enable/disable operation. <script type="text/javascript"> $(document).ready(function() { $("#ddlUser").change(function() { var selectedValue = $(this)[0].value; if (selectedValue == "--Select User--") { $("#txtUserName").removeAttr...

ASP.Net MVC - Recompile after changing HTML markup?

In Asp.Net 1.0/2.0/3.0 (non-MVC) I used to be able to change HTML markup whilst debugging, hit CTRL-S and then refresh my page to see the difference. Can I do the same with Asp.Net MVC 2.0 using partial views or do I need to recompile the app each time? ...

Can't get ELMAH to works with ASP.NET MVC2 on IIS7.5

Hello, I try to use ELMAH on my ASP.NET MVC2 application, it works fine on the test server (Casini x86) while using the x86 version, but when I deploy it on the production server with the x86_64 version, I get a 404 error when I try to access "elmah.axd" and no errors are logged on IIS (but they are logged in Casini) Here is my Web.conf...

Get referring view in an Action - MVC2

This may be more of a best practice question. I have three views (create/details/edit) that all link to their own results view (createResults/detailsResults/editResults). Each results view shares a partial with a results table on it. When a user submits one of the three (c/d/e) views, should each results view have its own action, even...

Is there End httpRequest event

I have to share ObjectContext (from EF4) between many objects, so i'm creating one Context per one HttpRequest (i haven't found better way to do this), but there is little problem... When i use using (ObjectContext ctx = new ...) {} it always disposes context after closing bracket. So how should i dealt with it when my context lives...

Why do you need to include parent dlls in child asp.net projects?

I have a newly created asp.net MVC 2.0 application that is in a completely separate solution from an existing asp.net webforms application. Because I didn't want the user to have to log in again, I deployed the MVC application in the same site as the existing Webforms app - everything works great. One thing has me completely perplexed ...

What way should I take

I've been asked to start a new web project and I'm a bit scared of what path to take. I've been help this community and I've learned a lot from you as well in this last year, you are great! and when this question pop up, you are the only friends I can ask for a direct and responsible answer. The project has to handle more than 20000 on...

"Unable to start debugging" - VS2010 ASP.NET MVC 2

I can lunch debug session only once with VS2010 and ASP.NET MVC2. When i end first session and try to lunch another i can see... "Unable to start debugging" - no other messages, I'm using Visual Studio Development Server instead of IIS, Windows 7 64-bits I can add that few days ago i was working on Windows XP and everything was fine. ...

ASP.NET MVC 2 Routing with additional consistent parameters (not just controller & action)

Currently, I have URLs that look like this: http://www.example.com/user/create http://www.example.com/user/edit/1 But now, I have to support multiple organizations and their users. I need to have something like this: http://www.example.com/org-name/user/create http://www.example.com/org-name/user/edit/1 I was having trouble getting...

ASP.NET MVC2 - Checking IsPostBack on load of user control doesn't seem to be correct?

Hi, I have a user control which contains the following code: <form id="CurrencyForm" method="post" runat="server"> Display prices in&nbsp; <asp:DropDownList ID="currency" runat="server" AutoPostBack="true"> <asp:ListItem Value="GBP">GBP (£)</asp:ListItem> <asp:ListItem Value="USD">USD ($)</asp:ListItem> ...

Advanced ASP.NET MVC routing scenario

Hello, I have an ASP.NET MVC app with the following deployment requirements: The URL structure must be something like: http://server/app/[enterprise]/[communinty]/{controller}/{action}/... What I think I want to be able to do is intercept the URL before the MVC route handler gets its hands on it, remove the [enterprise]/[community] p...

asp.net mvc -> Roles.IsUserInRole(username,role)

Do we need to add any references or import any namespace for Roles.IsUserInRole(username,role) - > is it not giving the right result. <% if(Model.Count < 1) {%> No User's Add Under You! <% } else { foreach (var item in Model) { %> <tr class="tblheader"> <th> User Name </th> <th> Last Activity...

including a captured image in a web form post, is there a better way

Following the Saving Snapshots to PNG in Silverlight 4 and the WebCam sample code, I have a silverlight app that I can place on my html form to capture an image from a web cam. I would now like to include the image in a html form post to my MVC controller/action. At this stange in the project I'm restricted from moving the whole data e...