asp.net-mvc

Embeded FLEX Control Hosted in JBOSS, How do i use Http Basic Authentication with "embed" or "object" tags?

So we have three FLEX controls hosted within a JBOSS server instance, and an IIS (MVC) application which has pages that have the object (and embed) tags to render the controls. We are wanting to setup HTTP basic authentication on the jboss server which is hosting other services (Solr, some custom webservices, and tika) and have figured ...

List of Objects to be used on ascx view with Inherits data already loaded MVC...

I have an object list being loded from a database to a drop down list. The Model loads the data to the Controller. The aspx view includes an ascx view. The ascx view already inherits data from another Project. I cannot set my List object in the ascx page. Can this be done? Model ... string List = dr["example"].ToSt...

List of objects to JSON to Html Table?

If I have a list of objects IEnumerable<MyType> myTypes; Is it possible for me to return this to the client as JSON return Json(myTypes); and if so, is it possible for me to convert this (now JSON format) list to a <table> when it gets to the client? Is there any jQuery plugin to do this? The thing is, there's loads of other stuf...

asp.net mvc json result format

public class JsonCategoriesDisplay { public JsonCategoriesDisplay() { } public int CategoryID { set; get; } public string CategoryTitle { set; get; } } public class ArticleCategoryRepository { private DB db = new DB(); public IQueryable<JsonCategoriesDisplay> JsonFindAllCategor...

MVC Localization ViewData["message"]

If i wanted to get message for ViewData from resource file, depending on the culture i set, how can i do this? ViewData["message"] = "ErrorMessage"; am i making sense ...

ASP.Net MVC View and Controller file structure

I am very confused the View and corresponding controller has to be set in MVC 1.0 project structure. Currently in a default application we have About.aspx page under Home folder and all the controller action is handled in HomeController. This controller mixes up Home action and About action. It makes things messy. I like to have clear s...

How do I obtain an HtmlHelper<TModel> instance for a model in ASP.NET MVC?

Let's say I have an Index view. The model I pass in is actually a collection of models, so the Html property is of type HtmlHelper<List<MyModel>>. If I want to call extension methods (e.g., Display() or DisplayFor() on the individual items in the list, however, I think I need to obtain an HtmlHelper<MyModel>. But how? I tried using the ...

ASP.NET MVC - Custom object instantiation / providing with the Modelbinder?

Is it possible to customize the object initiation / providing with the default ASP.NET MVC Modelbinder? <AcceptVerbs(HttpVerbs.Post)> _ Function EditObject(id As int, <Bind(Exclude:="Id")> obj As BLL.Object) As ActionResult End Function I would like to 'provide' obj to the modelbinder. (i don't want the Modelbinder to use New() and i...

ASP.NET MVC not using controller for explicit file route in IIS7

Consider a StaticResourceController that locates and serves files. I've set up an explicit route for "favicon.ico" that will handle the request for this file using StaticResourceController: routes.MapRoute( "favicon", "favicon.ico", new { controller = "StaticResource", action = "Get", file = "favicon.ico", area=...

.NET - Retrieve attribute from controller context?

I have a controller insert action: <AcceptVerbs(HttpVerbs.Post)> _ Function InsertObject(<Bind(Exclude:="Id")> <ModelBinder(GetType(CustomModelBinder))> ByVal object As SomeObject) As ActionResult End Function And i have a CustomModelBinder class with a BindModel implementation: Public Function BindModel( _ ByVal controllerContext A...

When are SQL views appropriate in ASP.net MVC?

I've got a table called Protocol, a table called Eligibility, and a Protocol_Eligibilty table that maps the two together (a many to many relationship). If I wanted to make a perfect copy of an entry in the Protocol table, and create all the needed mappings in the Protocol_Eligibility table, would using an SQL view be helpful, from a perf...

UpdateModel() fails after migration from MVC 1.0 to MVC 2.0

We are in the process of migrating our ASP.NET MVC 1.0 web app to MVC 2.0 but we have run into a small snag. In our report creation wizard, it is possible leave the Title text box empty and have it be populated with a generic title (in the post action). The code that does the update on the model of the Title is: if (TryUp...

ASP.NET MVC Creating a impersonated user.

Hi, I have a MVC app where I have a User class and the user can also impersonate another user(Admin users only). So I have this code below that authenticates the request and instantiates my version of a User class. It then tries to get the impersonated user from the Session object but Session is not available in this method in the glo...

Modify post data with a custom MVC extension?

So I'm looking into writing some custom MVC extensions and the first one I'm attempting to tackle is a FormattedTextBox to handle things such as currency, dates, and times. I have the rendering of it working perfectly, formatting it, working with strong types and everything all golden. However, the problem I'm now running into is cleanin...

Adding bindingRedirect element in web.config when upgrading from asp.net mvc 1 to asp.net mvc 2

Hi all, I have got a question with regards to upgrading asp.net mvc applications from v1 to v2... I've noticed in the ASP.NET MVC v2 Release notes that we need to add this code (please see below) when upgrading, but it did not state what would be the purpose of it because I've tried experimenting some of my apps to asp.net mvc 2 withou...

How to return a file result when I don't know the content type

I have an asp.net mvc action that returns a file result. Behind the scenes, it's just returning a file from a directory. FilePathResult requires a content type, but I don't know that. What is the proper way to return a file result if I only have the path to the file available? ...

Time to start returning IQueryable<T> instead of IList<T> to my Web UI / Web API Layer?

I've got a multi-layer application that starts with the repository pattern for all data access and it returns IQueryable to the Services layer. The Services layer, which includes all of the business logic, returns IList to the Controllers (note: I'm using ASP.NET MVC for the UI layer). The benefit of returning IQueryable in the data ac...

ASP.NET MVC Routing - Redirect to aspx?

This seems like it should be easy, but for some reason I'm having no luck. I'm migrating an existing WebForms app to MVC, so I need to keep the root of the site pointing to my existing aspx pages for now and only apply routing to named routes. Here's what I have: public static void RegisterRoutes(RouteCollection routes) { ...

How can I validate the result in an ASP.NET MVC editor template?

I have created an editor template for representing selecting from a dynamic dropdown list and it works as it should except for validation, which I have been unable to figure out. If the model has the [Required] attribute set, I want that to invalidate if the default option is selected. The view model object that must be represented as t...

Displaying a silverlight plugin in a jQuery UI dialog box not sizing correctly.

I have a login page which detects if silverlight is installed and will degrade to html when it is not. I'm using jQueryUI.dialog to display both; the dialog box appears but is too small to see the content completely and i have to resize it manually. I think it's something to do with the order the javascript is running on the page. Can ...