asp.net-mvc

How to access Page.Header.Controls in ASP.NET MVC 2?

Is there a way to access Page.Header.Controls in ASP.NET MVC 2? Edit I want to create a helper which can manage scripts. Yesterday, after I asked this question I discovered, that ViewPage and ViewUserControl has Page property. I think this allows us to access Page.Header.Controls. ...

How can I pass the correct instance of a type to an MVC Controller using Castle Windsor?

I have a problem that I can't seem to resolve. I'm sure it's simple, but I honestly cannot figure it out. I have a simple type that I reuse on multiple controllers. The problem that I'm faced with is that it's the SAME type with different configurations. I need different instances of this type to be used on different controllers. I've du...

What are the main disadvantages of Java Server Faces 2.0?

Hi, Yesterday I have seen a presentation on Java Server Faces 2.0 which looked truly impressive, even though I am currently a happy ASP.NET MVC / jQuery developer. What I liked most about JSF is the huge amount of AJAX-Enabled UI components which do seem to make development much faster than with ASP.NET MVC, especially on AJAX-heavy sit...

Bind value of dynamic jquery select list on post

Hi, Am new to this and just trying to submit dynamically populated select list on POST in MVC. Have read this post but don't quite understand the details of the solution, or simply can't get it to work. Here's my code: $(document).ready(function () { $("#SpecificID").hide(); $("#ObjectKindID").change(function () { ...

How to upload file from MFC client (CInternetSession) to ASP.NET MVC

I am using the MVC app as a service, so i have deleted the views. I am able to make calls to the controller: public class HomeController : Controller { // GET: /Home/ public string Index(string param1, string param2) { ... } from the MFC app: string URL(_T("http://localhost:2374/home/index/myparam1/myparam2")); pHt...

react in controller, which and if action link is clicked in view

Hello all, In my view "EditUser" I have an action link which i click not always: <%= Html.ActionLink("Resend forgotten password", "EditUser", this.Model.UserName, null)%><br /> In my controller "AdministrationController" i have an EditUser ActionResult there i would like to call Method which send forgotten password. But I dont know...

mvc contrib grid - pager

Hi, I am using the mvc contrib grid and generate the pager like this: <%= Html.Pager((IPagination)Model) %> This produces something like this: Showing 11 - 20 of 200 first | prev | next | last Is there a simple way to produce something like this which shows 'neighboring pages': Showing 11 - 20 of 200 first | prev | 1 2 3 4 ... | n...

Bug with tuple and Typed views?

Got a werid problem with a view, if i define it with Inherits="System.Web.Mvc.ViewPage<List<Tuple<string, DateTime?, double?, double?, double?>>>" i get the werid error: CS1003: Syntax error, '>' expected Line 118: public class views_report_intrestcalc_aspx : System.Web.Mvc.ViewPage<List<Tuple<string, System.Web.SessionState.IRequ...

ASP.NET MVC partial views slow?

I just happen to check the performance of an ASP.NET MVC application we are building. I was going to insert a partial view into a loop, and just out of curiosity I checked how long it took to render the page. The result was not good. I need to do more conclusive investigation, but just in case there was somebody with similar issues or m...

Passing data from the model into custom validation class

I have a data validation class that checks whether the start date of a meeting is before the end date. The model automatically passes in the date that requires validation, but i'm having a bit of difficulty passing the data that it needs to be validated against. Here's my validation class sealed public class StartLessThanEndAttribute ...

how do i put backcolor on a selectListItem

i have an asp.net mvc page and i want to have a dropdown list with different background color like this page i have the following code to display a dropdown list <label>Data Source: </label><% = Html.DropDownList("DataSource", Model.CalendarDataSources, new { @id = "calendarDSDropdown", @class = "calendarDSDropdown" })%> in my viewmo...

Using ELMAH in medium trust

Hi, I'm building an ASP.net mvc app, and am having some problems getting ELMAH deployed using xml logging to a medium trust server, though it works fine on my local machine. It keeps getting a 404 error. The problem might be that the host doesn't allow relative filepaths, so the "~/App_Data" doesn't work for logging. I switched tha...

How to parse a string URL into MVC Route Values (area, controller, action, querystring)?

Is there a method to extract the area, controller, action, and querystring from a URL in ASP.NET MVC? Don't want to reinvent the wheel implementing my own if there's already a way to do it. Thanks! ...

ASP.NET MVC button multiple clicks

ok i have a form on which i have some validation through dataannotation which is client side as well as server side validation like some field already exists. i have no javascript validations on the page. now my problem is that what should i do if the user presses the save button multiple times (he keeps pressing the button for 15 times,...

ajax editing in Telerik Grid, Display Templates are not rendered when update the row.

I have a telerik grid, when I edit a row: but if i pressed the update button or even cancel(watch the mid column): here is the declaration: <%= Html.Telerik().Grid<AlefTech.HumanResource.WebModule.ViewDto.MaritialStatusItemEditDto>(Model) .Name("Grid") .DataKeys(keys => { keys.Add(c => c.MaritialStatusItemID); ...

ASP.Net MVC DropdownList and selected value

I was able to create a dropdownlist for my MVC project, but the value is not selected as selected value on the dropdownlist. It just shows whole county list from the first.The value is from database. I tried find it from previous post, but it was quite confusing. Please, suggest me for any idea. Controller Code public ActionResult Edi...

NHaml T4 templates for CRUD?

Hello, I want to ask if anyone have or seen T4 templates for NHaml that are same as default T4 CRUD (List, Create etc) templates from MVC 2.0? Thanks for any source :) ...

How do I configure ASP.NET MVC routing to hide the controller name on a "home" page?

Following on from this question: ASP.NET MVC Routing with Default Controller I have a similar requirement where my end user doesn't want to see the controller name in the url for the landing or "home page" for their application. I have a controller called DeviceController which I want to be the "home page" controller. This control...

Verify that a URL maps to an actual route in ASP.Net MVC

To support legacy URLs in my application, I use a regex to convert URLs of the form /Repo/{ixRepo}/{sSlug}/{sAction} to the new form /Repo/{sName}/{sAction}, using the ixRepo to get the correct sName. This works well, and I can redirect the user to the new URL with a RedirectResult. However, I'd like to catch legacy URLs with an invalid...

ASP.NET MVC: DropDownList validation

Note: The following is just an example. I'm pretty new to ASP.NET MVC and I'm trying to get my head around how validation of dropdown lists work. I have the following property in my ProfileViewModel class: [DisplayName("Gender")] public bool? Gender { get; set; } null is meant to mean "unknown", true female and false male. In the vie...