asp.net-mvc

is there any limit on css file size?

I am using ASP.NET MVC to develop a site. The CSS file has grown to 88KB and is having a little more 5,000 lines. I noticed recently that styles added at the end are not there in the browser. Is there any size limit on CSS file or on the number of lines? EDIT: Sorry I forgot to mention that this problem is occurring in Windows 7 both in...

Why is BaseController's overloaded constructor not being executed?

I have a base controller which is defined as follows, but the constructor that takes the ISiteService never gets executed: public class BaseController : Controller { private ISiteService _siteService; public BaseController() {} public BaseController(ISiteService siteService) { _siteService = siteService; // thi...

asp.net mvc loading partial view in popup

how will i load a page or a partial view in the popup window in jquery. i am using jquery popup but it is not loading with javascript ...

Can i put ASP.NET in Js file?

I am doing an ajax "Post" action and i need to work out the URL of my action. To do this i am using var url = '<%= Url.Action("Action", "Controller") %>'; But this code lives in a rather large Js file that is loading into my MVC View. I dont want to move it all into my view as it is too big and will look a mess. I tried setting ...

How to check if a method return an Iqueryable returns anyhting

Hi, In my ASP.NET MVC 2 C# web app I have a repository that contains method that returns an Iqueryable. My controller calls this, handing over some variables to it so it an run a linq to sql query. How can I check to see if the returning iqueryable has returned anything/contains anything to the controller? Basiclly check if it is returns...

Pass an & as Part of a Route Parameter

Unfortunately I need to accept a route parameter with an & in it. I have this route definition. The id parameter will sometimes have an & in it like this X&Y001. routes.MapRoute( "AffiliateEdit", "Admin/EditAffiliate/{*id}", new { controller = "UserAdministration", action = "EditAffiliate", i...

how can i embed a powerpoint slide into a webpage

is there any clean way of doing this that works in all browsers? ...

pass parameter to repository while maitaining separation of concerns

Hi all. I'm new to mvc and this whole way of programming is pretty unfamiliar for me, so be gentle ... I have in my article repository: public IQueryable<Article> GetArticles(int? category, int? position) { return from a in dc.Articles where a.LanguageIndex == lang && a.CategoryIndex == category && a.ArticlePosition == p...

Silverlight ASP.MVC routes

Hi, how can I emulate stuff like <%=Url.Action("Action","Controller" ... where I am using Silverlight 4 as the client to ASP.MVC in say OpenReadAsync? Aside from passing it a Uri with the full path as a string - not preferred. Cheers ...

How to redirect from OnActionExecuting in Base Controller?

I have tried two ways: Response.Redirect() which does nothing, as well as calling a new method inside of the Base Controller that returns an ActionResult and have it return RedirectToAction()... neither of these work. How can I do a redirect from the OnActionExecuting method? ...

Anyone Using a Custom ViewMasterPage?

Lately when I've been building my asp.net mvc apps I tend to have a number of items that consistently need to be calculated, formatted and configured in my master pages. Some of these items include: I like to attach specific classed to the body tag like WordPress does to help my CSS out. I usually attach the name of the action, control...

Posting text with html tags without changing the requestValidationMode?

I implemented tinyMCE to fulfill the "we need a rich text editor" requirement but when posting the form to the controller I get the expected "A potentially dangerous Request.Form value was detected from the client" error, in .net 3.5 we could just use [ValidateInput=false] in the action and go on with it, but now we also have to set requ...

Using complex model in MVC 2

I have: 1) public class Model { public String Name { get; set; } public SubModel SubModel { get; set; } } 2) public SubModel { public String Title { get; set; } } 3) Model-typed ModelViewUserControl 4) SubModel-typed SubModelViewUserControl 5) Page I need: Show on the Page 2 TextBoxes: for Model.Name and Model.Su...

asp.net mvc route to a div on view

I want to create a link to a specific div on a view. I was thinking something along these lines <a href="<%= Url.Action("#about", "Home") %> > </a> or <a href="<%= Url.Action("~/Views/Home/About.ajax/#about")%> > I know this isn't right. How can I create a link to a div or specific tag on the destination view, in the style of <a ...

Intent of Data Annotations Model Binder

The article here mentions the use of Data Annotations Model Binder that is available here. Does anyone know what it's intent is? To do DA validation, I don't need a special Model binder in MVC 2.0 ...

MVC Ajax not loading Partial View in div, loading new page

Hello, I'm currently working with MVC 1.0 and have never worked with AJAX before and only have limited experience (started a little more than a week ago) with ASP.Net MVC. I'm trying to setup a table (that's built / is in a partial view) that's populated with information from a db that allows a user to quickly add pr remove records into...

How to create menu/submenu using MVC?

Hi, I need to create a menu(parent) with three subelements like (Add,Edit,Delete). <li ><%= Html.ActionLink("Log", "Index", "Log")%></li> <li><%= Html.ActionLink("Administration", "Administration", "Log")%></li> </ul> Under Log I need to add three elements ...

ASP.net MVC2 - Customize Metadata without using Custom Attributes

I'm pretty new to MVC, I'm trying to create a model that can be localized, but it doesn't seem like that would be possible given that I have to use a custom property attribute to define displayname and validation properties. Is there a way to dynamically create the model metadata attributes (DisplayName, UIHint, etc..) as opposed to h...

LINQ to SQL find average of field?

I have a ViewModel called EntityRating, one of whose properties is AverageRating. When I instantiate a new object of my ViewModel (called EntityRating) type, how do I set the EntityRating.AverageRating based on the Rating field (in SQL Server) of the item in question? I want to do something like this (which obviously doesn't work): va...

ASP.NET MVC 2 Model Validation (DataAnnotations) on Subobject

Does the ASP.NET MVC 2 model validation includes subobjects? I have an instance "Filter", from this class: public class Filter { [StringLength(5)] String Text { get; set; } } in my main object: public class MainObject { public Filter filter; } However, when I do TryValidateModel(mainObject) the validation still works o...