asp.net-mvc

Ninject not firing?

I'm trying to set up Ninject for the first time. I've got an IRepository interface, and a Repository implementation. I'm using ASP.NET MVC, and I'm trying to inject the implementation like so: public class HomeController : Controller { [Inject] public IRepository<BlogPost> _repo { get; set; } public ActionResult Index() {...

ASP.Net MVC - Style List Item Based On Controller

My ultimate goal is to have a menu that adds a class to the list item that associates with the current page I am on. So I have it set up such that each controller will be associated with an item in my menu. I need to add a class to that list item (changing the color, background, whatever). Is there a simple way to do this? Pass a v...

Where's the repository for the MonoDevelop ASP.NET MVC Support for the 2.1 trunk

I'm using the openSUSE 11.1 VM with the latest MonoDevelop 2.1 trunk and Moonlight SDK. I wanted to add ASP.NET MVC support but I can only find the 2.0.5 version in the repositories. Is there another repository where this can be found? ...

Is there a point at which an Enum can get too bloated?

I've defined an Enum as part of the model objects for an ASP.NET MVC application. The Enum is called 'ContentTypes' and looks something like this: public enum ContentTypes { [Description("News story")] NewsStory = 1, [Description("Article")] Article = 2 } Now I'm planning to add another set of attributes to the enum ...

Request.File.Count is still set to 1 when File Upload in ASP.Net MVC encountered a previous error

Hi there, I'm developing a form in ASP.Net MVC where it contains an <input type="file" /> which is not mandatory in a form. In my controller, I have this code: [AcceptVerbs(HttpVerbs.Post)] [ValidateInput(false)] public ActionResult Create(FormCollection collection) { ... //get uploaded file if (Request.Files....

Asp.net Mvc: Ajax delete multiple users.

Hello, lets say I got multiple users. They all have items linked to their account. They can CRUD those items. So now my question is: what's the best way to prevent users from manipulating items from eachother. At first I thought the antiforgerytoken would help. But it doesn't because when the users look at their control panel they got...

ASP.NET MVC: enums and ViewData[] keys

For ViewData, rather than using strings as the key, I'm using enums. I currently have one big list right now that can be accessed from anywhere. Some enums are used across multiple Controller/View pairs. Is there a better way to categorize these enums rather than just an ever growing list? I don't like the hard coded strings that a...

ASP.NET MVC class that represents a controller+action set?

Is there a class in the ASP.NET MVC framework that represents a controller name and an action name? I'm writing a method that will return a collection of URLs and I want them to be returned as objects that contain a 'Controller' and 'Action' property or something similar. This is because sometimes I'll need to isolate just the controll...

JqGrid not function with asp.net mvc

Hello to all, is my first time in this forum, I have a problem with the jqGrid, I can not get it to work, and this problem is by about 2 days that I can not risolvere.Il problem is that if I put the code javascript within the jqGrid View: Home then everything works, but if I change my path, for example, Client / LinqGridData gives me the...

ASP.NET MVC: relationship between models and MembershipUsers

Hi, I have a model, Docs, with a guid column, author_id, which should reference a MembershipUser. I'm using the standard MembershipProvider (I only changed the db name), and of course I haven't a model for MembershipUsers. I can easily define some methods in class Docs to get MembershipUser for a Doc and all Docs for a MembershipUser,...

URL Constraint for numeric IDs

Hi folks, I am trying to create some URL constraints for controllers to prevent null reference exceptions. For example /folder/edit/3 should be okay /folder/edit/asdf shouldn't be okay Instead of adding a Regex on every action method I want to use URL constraints for that. The Problem I am facing right now is that the default route...

JQuery firing before my data is loaded in the page controls

I am using ASP.NET MVC and jQuery. I have this code in my js file. It should hide and show certain divs when a user clicks on a radio button. I would also like to fire this on the page load using the trigger method. My problem seems to be that when the event is trigger my default values from the model haven't been loaded into the cont...

Store user information in session?

Should you store info about the user required for each request eg. Role, email, username etc. in Session, or is ok to goto the database each request for this information?? Thanks ...

Can I map new routes to the RouteCollection outside Global.asax?

I'd like to occasionally map new routes to the RouteCollection during program execution long after the Global.asax RegisterRoutes() method had first executed. How can I do this? ...

IIS7 - Password Protect Development Server

Hi, I have a development server running IIS 7.0 with an ASP.NET MVC Web Application, that authenticates using Forms Authentication/Membership. I need to be able to prevent unauthorized users from viewing this site. Our customers however should be able to enter a simple username/password to gain access. After they do so, they should ...

An .ascx user control page opens up as hex?

I am not sure if this is related to this weird behavior I'm experiencing: http://stackoverflow.com/questions/1229811/why-is-my-asp-net-mvc-project-saving-several-copies-of-itself But I'm completely stumped. My solution (asp.net mvc application) currently resides on the thumbdrive (cruzer micro 4gb), all the files were fine as of last n...

ASP.NET MVC Membership: how can I create/configure it?

Hi everyone! I'm having a huge problem in understanding Membership with MVC. We have in our project controllers named "Admin" and "SuperAdmin" and they are restricted to some users. Do I have to use the Authorize Roles attribute on each Action or can I use a ActionFilter to check if an user can view a certain page? And if I have to us...

jquery modal windows - closing frustrations with greybox and jqmodal

I've been trying to get modal windows working on a new site for some time now. I first tried jqmodal and had no issues displaying the modals, but the close buttons never worked - or at least they worked on some pages but not on others. I put a great deal of effort into debugging and couldn't find the issue. I recently tried out greybox ...

ASP.NET MVC: jQuery Post and files

Hi, I have a simple form with some text inputs and a file input. I do not send it directly with a post, but I read each value of the text inputs with jQuery, compose a $.post request and send it to the server. How can I do the same with a file <input type = "file" />? I mean, sending it via ajax to a ASP.NET MVC page? Thanks in advanc...

Adding Multiple Static options to a Drop-Down in ASP.NETMVC

Hi, I want to add two default options to my dropdowns in asp.net MVC using the html helper class, they are "--Please Select--" and "--Other--". I can add one static option using <%= Html.DropDownList("ddlserviceGroup", (IEnumerable<SelectListItem>)ViewData["ServiceGroups"], "--Select Item--")%> But i need to add two options an...