asp.net-mvc

MVC - Partial Views

Hi, I have a Viewpage menu with controller Menucontroller. I have a partialView ViewItems which is strongly typed as object BagItem with contro ller BagItem. I am trying to render the partial View from View page(Menu.aspx) and can't render partial View. Any help would be greatly appreciated.New to MVC. Here is the code Menu.aspx <%@ Pa...

cms in ASP.NET/MVC literature

I got my theme for "graduate work" (I dont know if this is the right term but I think you'll understand :)) which is: Developing CMS in ASP.NET/MVC What I need is some good literature and if someone could recommend something I would appreciate it! ...

ASP.NET MVC : Response.Redirect(url, TRUE) does not stop request processing.

I have a method decorated with two custom ActionFilterAttribute. [RequiresAuthentication(Order = 1)] [ToonAction(Order = 2)] public ActionResult Browse(... RequiresAuthentication attribute is coming from this article Inside RequiresAuthentication, on it's OnActionExecuting I do: filterContext.HttpContext.Response.Redirect(loginUrl...

Foreign keys not working in link table in Linq2Sql

I have 3 tables Subcontract, Company, and a link table CompanyToSubcontract. The link table contains the Subcontract_id and the Company_id. The foreign keys were set-up in SQL and when I drug them into my dbml the one-to-many relationship arrows showed up and everything looked fine. However, when coding, it's as if the relationship is...

How to get FormValueProvider instance in a Custom Model Binder in ASP.NET MVC 2

I'm using the MVC 2 RC. I have a custom model binder that used to iterate over posted form values in MVC 1.0 like this: var values = bindingContext.ValueProvider.Where(x => x.Key.StartsWith("prefix")); foreach (var value in values) { /* do something */ } In version 2, I can't do this anymore. Apparently there are new implementatio...

LINQ sorting, doesn't work

I have a LINQ query like this: from i in _db.Items.OfType<Medium>() from m in i.Modules from p in m.Pages where i != null && i.Type == 1 && i.Published == true && p.PageId == 2 select p I use the query like this because I have strongly typed view (ASP.NET MVC). I need to have items sorted by the i.Sort property. orderby i.Sort and i....

Relative Paths in Javascript in an external file

So I'm running this javascript, and everything works fine, except the paths to the background image. It works on my local ASP.NET Dev environment, but it does NOT work when deployed to a server in a virtual directory. This is in an external .js file, folder structure is Site/Content/style.css Site/Scripts/myjsfile.js Site/Images/filter...

A Solution for Maintaining Views in Single-Project Areas

I have only tried this in single project areas. So if anyone tries this in a multi-project areas solution please let us know. Area support was added to MVC2. However the views for your controllers have to be in your main Views folder. The solution I present here will allow you to keep your area specific views in each area. If your proj...

Autofac doesn't like MVC Source

I added the ASP.NET MVC 2 RC2 source code to my solution (using these instructions: http://blog.stevensanderson.com/2009/02/03/using-the-aspnet-mvc-source-code-to-debug-your-app/), but now it won't build because of an error from Autofac. The type 'System.Web.Mvc.IControllerFactory' is defined in an assembly that is not referenced. You m...

Validating Captcha after server round-trip and subsequent re-generation of captcha

I'm implementing CAPTCHA in my form submission as per Sanderson's book Pro ASP.NET MVC Framework. The view fields are generated with: <%= Html.Captcha("testCaptcha")%> <%= Html.TextBox("attemptCaptcha")%> The VerifyAndExpireSolution helper is not working as his solution is implemented. I'm adding validation and when it fails I add a...

is a query string with a / in it valid?

Due to a miscommunication with an affiliate partner we're working with the URL they call on our server has been mixed up. This is the URL they are supposed to call on our server : /AAAAAAAA/?b=CCCCCCC unfotunately it was implemented in their system as this ?b=CCCCCCC/AAAAAAA I can easily parse out the components, but I'm worried...

Problem retreiving cookies from HttpResponse

I have a controller action that I call via Ajax in which I set a cookie like this: Response.Cookies["Notifications"].Value = "false"; Response.Cookies["Notifications"].Expires = DateTime.Now.AddYears(1); In another controller action I am checking for this cookie like this: if(Request.Cookies["Notifications"] != null && Request.C...

IIS 6 Virtual directory MVC not working but Subdomain is

I get the following error when using MVC as a virtual directory The value for the 'compilerVersion' attribute in the provider options must be 'v4.0' or later if you are compiling for version 4.0 or later of the .NET Framework. To compile this Web application for version 3.5 or earlier of the .NET Framework, remove the 'targetFramewo...

Trying to save changes to a SQL databse, results in "Cannot open user default database. Login failed."

I am building an MVC application with C# as my language which is hosted on Widows 7 IIS. A call to Add a new member to the database works, but when attempting to save the change I get the following error: Cannot open user default database. Login failed. Login failed for user 'IIS APPPOOL\myApplication' The SQL table was added just by a...

asp.net mvc: difference between dropdown & textbox onchange event

Having some pain with this event, I have some code like this for a dropdown: return helper.DropDownList(data.ModelEntityId.ToString(), selectList, "<Select>", new { onChange = onChange }); where onChange is a variable containing a javascript function to run, this works great. However with the textbox version (below) the onchange even...

What are the best practices when using jQuery Ajax calls?

I'm reviewing some code for a colleague and while there's nothing inherently wrong with the jQuery Ajax calls I'm looking at, I would like to be more certain about what should and should not appear in a normal Ajax call to an ASP.Net MVC controller action. For example, in the following code: $(function() { $.ajax({ ...

Is ASP.NET MVC's FileStreamResult less efficient than writing directly to the Response Output Stream, or am I missing something?

First of all, I love ASP.NET MVC. This question is not a criticism of it. Rather, I want to confirm what I think I see and make sure I haven't missed something. Bear with me ... I can't get to the question without providing a little bit of context. The question has to do with returning data in a Stream in response to an HTTP Post. In th...

Sharing partial views between MVC projects - Do Areas Help?

Hi, We have some partial views which need to be used in several MVC projects. Has anyone done this successfully? Could Areas in MVC 2 be of any use ? Could a sub area project use a partial view from the parent project or the other way around? Thank you ! ...

Export to Excel using JQuery plugin on ASP.NET MVC view page?

Hi I have a button on ASP.NET MVC View page. When the user clicks on this button, i have to export the data using JQuery plugin. Appreciate your responses. Thanks ...

Do swfupload have any issues with authentication?

Do swfupload have any issues with authentication in asp.net mvc? ...