asp.net-mvc-2

VS 2010 beta 2: ASP.NET MVC2 project cannot add Areas

眉间皱痕 提交于 2019-12-11 04:52:36
问题 I have installed VS 2010 beta 2 on my Vista Home Premium 64-bit edition laptop. I was so excited on MVC 2 but to my disappointment, I cannot add Areas to the MVC 2 project. Anywone experiencing this too? Or is it only me? I would love to hear some info / walkthrough on how to fix this problem. Thanks! EDIT: added screenshot alt text http://img14.imageshack.us/img14/4009/mvc2w.jpg 回答1: Here's a walkthrough on adding areas in ASP.Net MVC 2 on MSDN 来源: https://stackoverflow.com/questions/2136074

storing files in sql server 2008 using the filestream option

感情迁移 提交于 2019-12-11 04:47:34
问题 i am using an asp.net mvc 2 application to upload files and store them in a sql server 2008 db. I would like to use the filestream option. Does anyone has any code samples for this? 回答1: The SQL part: -- Enable the FileStream Feature EXEC sp_configure filestream_access_level, 2 GO RECONFIGURE GO --Create a special file group and mark it as a stream CREATE DATABASE FileStreamExample ON PRIMARY ( NAME = FileStreamExample_Primary, FILENAME = 'c:\Data\FileStreamExample.mdf'), FILEGROUP

Custom model binder for child collection

。_饼干妹妹 提交于 2019-12-11 04:47:13
问题 I've searched high and low so hopefully someone can help me. I have a class: public class Person { public string Name { get; set; } public ICollection<Toys> { get; set; } } I have a controller method: public ActionResult Update(Person toycollector) { .... } I want to bind to the collection. I realize I will only get the IDs but I will deal with that in my controller. I just need to be able to flip through the collection of IDs. I started writing a model binder: public class CustomModelBinder

Changing scripts folder in MVC application and using Telerik MVC Extensions

一世执手 提交于 2019-12-11 04:22:36
问题 I am using the Telerik MVC Extensions and have moved my Scripts folder in to the Content folder. So instead of ... <script src="<%= Url.Content("~/Scripts/jquery-1.4.1.min.js") %>" type="text/javascript"></script> ... I now have ... <script src="<%= Url.Content("~/Content/Scripts/jquery-1.4.1.min.js") %>" type="text/javascript"></script> I realise that I can turn off jQuery inclusion with the ScriptRegistrar().jQuery(false) method, but how to I tell the Telerik MVC Extensions where the new

Use a different port with RequireHttps filter in MVC2

僤鯓⒐⒋嵵緔 提交于 2019-12-11 04:08:03
问题 Is it possible to use [RequireHttps] filter with a different port other than 443? I can't find much documentation about it. 回答1: Steve Sanderson's approach finally worked fine for me. No need to use the MVC2 filters. 回答2: Subclass it and override HandleNonHttpsRequest(). From within that method, you can manipulate the URL as necessary. (For example, you can call base.HandleNonHttpsRequest(), then modify the filterContext.Result property to include a port number.) Then use

Forms Authentication Provider for Azure MVC2 app?

和自甴很熟 提交于 2019-12-11 03:59:00
问题 Ideally, I'd like to use Azure table storage as the provider, but SQL Azure will also work. Anything I've dug up so far is over a year old, using deprecated approaches. I.e., outdated code samples, SDKs and IDEs. As the title states, this would be applied to an MVC2 app running in Azure. Examples, code, links, etc. do not necessarily have to be for MVC. Anything related to a .Net 4.0 web app using Forms Authentication on Azure will do. 回答1: Microsoft originally released a set of sample

show dynamically selected columns in asp.net mvc grid at runtime

寵の児 提交于 2019-12-11 03:57:35
问题 I have an asp.net MVC application where I am using telerik grid to show the data/records.I am using the Entity Model. My requirement is that sometime I want to show only some of the columns specified at the runtime/may the user select. How do I bind View with only those columns as selected by the user . Initially view is binded with Model class with all columns . Is there any other way other than telerik to show the customized columns as selected by the user then it will be also OK . 回答1: You

Ambiguous action methods in MVC 2

有些话、适合烂在心里 提交于 2019-12-11 03:53:23
问题 I'm having some problems with ambiguous action methods in MVC 2. I've tried implementing the solution found here: ASP.NET MVC ambiguous action methods, but that simply gives me a "The resource cannot be found" error as it thinks I'm trying to invoke the action method I don't want to invoke. The RequiredRequestValueAttribute class I'm using is the exact same one as what was in the other question's solution: public class RequireRequestValueAttribute : ActionMethodSelectorAttribute { public

Alternatives to hidden fields in MVC2

跟風遠走 提交于 2019-12-11 03:48:08
问题 I have a viewModel that contains a string that is populated before being passed to a partial view. I need to be able to get the data back when the form is posted. At the moment I have created a hidden field and bound the data to it. Then when posting back I can get the data from the form collection. This isn't exactly what I would like. I would prefer for the data to be entirely hidden from view. Using sessions aren't really an option for the framework I have to adhere to. Is there any

ASP.NET MVC 2 HiddenField is empty?

天大地大妈咪最大 提交于 2019-12-11 03:32:52
问题 Hi, I have a ViewClass that contains a CI property (Guid), to keep track of this CI property I have added a hidden value for it like this : <%: Html.HiddenFor(model => model.CI)%> This does however render an empty hidden field, i have also tried : <%: Html.Hidden("CI", Model.CI)%> But with the same result. When just typing : <%: Model.CI %> The Guid is printed for example like this : 5f7a1f53-9f90-4b77-aad4-64e835662efc So why is this not working? Edit1 : This workes fine, but I do not see