asp.net-mvc

Help with MvcContrib Column options

Hi, I am using the MVCContrib grid and I would like to add some html attributes to a cell depending on the value of a column. I need something like this column.For(c => c.Type.Equals("Type A") ? "show value and add attribute" : "just show value"); I tried this but it doesn't work. It shows the value on the grid as - class="Type...

ASP.NET MVC2 - How to call another controller with RenderAction() as well as pass arguments to that controller?

I'm trying to render a partial view on my master page using Html.RenderAction() in VS 2010 using MVC2. Here is my RenderAction() call: <% Html.RenderAction( "Menu", "Navigation", new { currentAction = ViewContext.RouteData.V...

asp.net mvc routing to a specific file from any path for behavior url

I've got a bit of a problem with my asp.net mvc site in IE7. My web designer has included the following css to get a nice display in IE7: .container { background: #f2f2f2; border: 2px solid #ddd; padding: 12px; behavior: url(/devsite/Content/PIE.htc); -moz-border-radius: 10px; -webkit-border-radius: 10px; bo...

Implementing "Preview" functionality in asp.net mvc

Hi All, I am using ASP.NET MVC and jquery. I would like to implement preview functionality to a form. i.e. I have a form with number of fields for example name, address etc.. Before the user submits the info, he/she can preview it as to how it will appear on the site. Could any one please point me to right direction as to how I could im...

MVC drop down list that controls a grid - what is the best way to get this to work?

I have a drop down list on the client side. When the user makes a selection, my jquery script extracts the new value of the selection. But the code below does not work because I cannot work out how to send the selected value back to the controller. I am not sure about the syntax of sending the parameters as I am using paging parameters a...

Passing Array to Action from a $.post

I am having trouble passing my array via a $.post. The Javascript var privIDs = [1,2,4,5]; $.post("/Home/GrantPrivilegesToUser", { privilegeIDs: privIDs }, function (data) { alert("Data Loaded: " + data.success); }); The Action public ActionResult GrantPrivilegesToUser(int[] privilegeIDs) { return Json(new {success...

ASP.NET MVC 2 Controller To View: IList or List?

Should I return from model to view an IList<T> object or a List<T>? I would iterate over the Model collection and show the results in an ASP.NET MVC 2 view. ...

ASP.NET MVC 2 and CKEditor input validation

I need to configure both mvc and ckeditor to work properly with validation. At first, I got an error about the Form.Request is dangerous because it contained html elements. I changed that, now my output in mvc is not correct. Here is my code: CKeditor config: config.htmlEncodeOutput = true; ASP.NET Textarea: <%: Html.TextAreaFor(mo...

MVC EditorFor inside Another EditorFor

I have an EditorFor Template for a Model Role as below. I also have EditorFor for Date which works fine when I use EditorFor directly from View but when I have EditoFor inside an editor for it doesn't work. Any idea? Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl[ucsrManagementSystem.Models.ContactsInMailingListsViewMode...

How to make password field not reset?

I want to edit an user. I dispay the corresponding data(username, email,..etc..password, confirmation pass) The problem is that those password fields are empty. Q: When i display data in the form the two password fields are empty. How can i make them contain data? Thanks. I am using asp.net-mvc 2 <div class="edi...

Why am I forced to rebuild my project to see changes made to controllers in ASP.NET MVC?

I'm using ASP.NET MVC 3 Beta and for some strange reason, if I change a controller's action and load the action in a browser, it doesn't recompile the assembly to incorporate the changes made. Maybe I'm spoilt from how things were in ASP.NET Webforms, where there was dynamic on-the-flycompilation of code-behind files, but I think this sh...

JQuery UI button submitting entire content problem in IE 6.0

Hi, I have the same problem as posted here I have a <button> element that triggers "A potentially dangerous request.form value..." error in asp.net MVC. For instance: <button type="submit" name="logon" value="ok">Confirm</button> <button type="submit" name="cancel" value="ok">Cancel</button> And this javascript (with jquery UI 1.8.5)...

What is the advantage of using multiple Controller classes in ASP.NET MVC?

I'm just learning the basics of ASP.NET MVC and am wondering what the benefit is in breaking up website logic amongst multiple controllers versus just having a single Controller class that runs the whole website, besides simply organizing code better. (In my opinion, just the latter benefit should not be enough to affect the end user via...

redirect to an external url on form submit

i have a form which on submit should redirect to an external URL to perform some action with my form data, as well as remain on the home page after successful submission. i used redirection, but this will make my second option possible, but not my first one. Please help.. ...

How can I get 404 to work with Elmah and the HandleErrorAttribute written for Elmah in asp.net mvc?

I have implemented Elmah in one of my ASP.NET MVC projects. In addition I did the following: I implemented the ElmahHandleErrorAttribute written by Atif Aziz in this post I added the attribute to all my controllers I have setup Elmah to filter out 404 errors since I do not want to log those I added an Error.aspx view in the Shared fold...

How do I get this result using LINQ?

I am a beginner to LINQ and I have a query where I need result like this. Id | RoleName ------------------- 1 | Member 2 | Admin 3 | Manager 4 | Accountant Id | UserId| RoleId | ExpirationDate ------------------------------------- 1 | 1 | 1 | 1/1/2011 2 | 1 | 4 | 1/1/2012 3 | 2 ...

asp.net: using resource expressions with the resources in a separate project.

I'm pretty sure this is something super easy, but how do i access a resource that is in a separate project using the expression syntax? I thought it would be like so: <%$ Resources:SomeNamespace.Resources.Web, PleaseSelectAnImage %> where SomeNamespace.Resources is the project that the resources are located in. i normally just do <%=...

How can I programatically render Google Charts API images into a PDF file?

I'm rendering charts on my website using the Google Charts API and I want to export these into a report for the users, most likely a PDF file. What methods are available to do this programmatically into a PDF file? ...

How do I use the strongly-typed HTML helpers with nullable types?

I want to use the strongly-typed HTML helpers in ASP.NET MVC 2 with a property of my model which is Nullable<T>. Model public class TicketFilter { public bool? IsOpen { get; set; } public TicketType? Type{ get; set; } // TicketType is an enum // ... etc ... } View (HTML) <p>Ticket status: <%: Html.RadioButtonFor(m => m...

How to support NTLM authentication with fall-back to form in ASP.NET MVC?

How can I implement following in ASP.NET MVC application: user opens intranet website user is silently authenticated if possible if NTLM authentication didn't worked out, show login form to user user indicate login password and select domain from list of predefined domains user is authenticated in code using AD I know how to implem...