asp.net-mvc

Is there an efficient way to turn LINQ-to-SQL data into XML?

Hey Everyone, I'm looking at building a templating engine for my website. I'm using ASP.NET MVC and Linq-to-SQL. So, What I'm wanting to do is generate an XML document like this: <?xml version="1.0" encoding="utf-8" ?> <MainPage> <MainPageHtml><![CDATA[<p>lol!</p><br/>wtf? totally!]]></MainPageHtml> <Roles> <Role RoleId="1">...

ASP.NET Routing using wrong route to generate URL; route values become query string parameters

Relevant route registration code: routes.MapRoute( "QuestionsMostRecent", "questions", new { controller = "questions", action = "most_recent" } ); routes.MapRoute( "ControllerActionFormat", "{controller}/{action}.{format}" ); Route generation code: Url.RouteUrl(new { controller = "questions", action = "most_recent"...

Taking my MVC to the next level: DI and Unit of Work

I have looked at simpler applications like Nerddinner and ContactManager as well as more complicated ones like Kigg. I understand the simpler ones and now I would like to understand the more complex ones. Usually the simpler applications have repository classes and interfaces (as loosely coupled as they can get) on top of either LINQtoS...

Generic Inhertied ViewPage<> and new Property

Question Rephrasing Setup: CustomViewEngine CustomController Base CustomViewPage Base (in this base, a new property is added "MyCustomProperty") Problem: When a view is strongly typed as such: <@ Page Inherits="CustomViewPage<MyCustomObject" MyCustomProperty="Hello">, I get a compiler "Parser" error stating that MyCustomProperty ...

Asp.net MVC deployment application issues

Hi, I continually run into all sorts of issues where the application functions fine but when pushed to my shared hosting services it fails and throws various issues. Is the notion that once the "Integrated Pipeline" is setup for the Virtual Directory that a FTP push from a "Publish" action in the project should "just work"? It seems lik...

ASP.NET MVC issue

Hi, I have a ASP.NET MVC app and when I run it, it loads my Index action on my HomeController by default ok. But when I put in this URl I get 404 - Not Found error http://localhost/MyGoogleApp/Home/Index This is the same for any action I put in in Home Controller. Something fundamentally wrong, any ideas? Malcolm ...

Split Table column in Dynamic data

I am using an integer field in the DB to represent collection of booleans in order to save some space. the integer is used in my Business logic and transformed into collection Boolean attributes. i'v now decided to add "Admin" section to the site using Dynamic data feature, and i am wondering whether there is an option to show the Boolea...

ASP.NET MVC: ValidationAttribute and localized ErrorMessage

Hi! I have ValidationAttribute like: public class Username : ValidationAttribute { public override bool IsValid(object value) { if (value == null) return false; return RegExp.Validate(RegExpLib.Username,value.ToString()); } } ..and using it like this: public class AccountSignIn { [Username(ErrorMessageR...

How to decide what radioButton is on in a View?

In my controller I am setting my value to true: ViewData[itemName] = true; Then in my view I am trying to set the item with true as select radio button. I have tried the following: <%= Html.RadioButton("default",item.Name, ((bool)ViewData[item.Name])==null ? false:true) %> <%= Html.RadioButton("default",item.N...

Cannot inject WCF Service dependency in ASP.NET MVC with StructureMap

I have troubles injecting a WCF ServiceClient to a Controller's constructor using StructureMap. I followed Phil Haack's example on DI in ASP.NET MVC The WCF service I have is called LogService. It implements ILogService. The StructureMap.config looks like this: <?xml version="1.0" encoding="utf-8" ?> <StructureMap> <Assembly Name="Ya...

ExtJS: how to return json success w/ data using asp.net mvc

Hello, I am trying to use ExtJS with Asp.Net MVC, and it is going fine so far. (Nice work on ExtJS) To make things easier, I need some help returning data from .net to ExtJS. ExtJS expects to see a success flag in the JSON Respone along with additional data. a sample expectedresponse format is something like {success: true, data: {id...

Custom AuthorizeAttribute

I have a child class of AuthorizeAttribute named CheckArticleExistence. I would like to set an attribute using the parameter that I receive in the action. Like this: [CheckArticleExistence(Id=articleId)] public ActionResult Tags(int articleId) { ... } I want to use the articleId to check if that article exists in the database, and if...

Iterating through a Enumerable collection with nullable types

Hey, I'm trying to iterate over an Enumerable collection of mix of nullable types However I want to compare the nullable type with a intrinsic type such as string or decimal. i.e. Here is a snippet <% foreach (PropertyInfo prop in this.Columns) { %> <td> <% var typeCode = Type.GetTypeCode(prop.PropertyType)...

Where can I get an ASP.NET MVC Designs?

I am looking at the ASP.net gallery of designs that they have available and I cannot find anything that I can use as a base to customize. The project is a basic prototype so I cannot spend money on a designer yet, but I cannot let it go with the default scheme. Any ideas on where I can find a good mvc design that I can modify. As ma...

Why is my ClaimsRequest coming back null?

I have just begun experimenting with the DotNetOpenAuth project. Modifying the sample OpenIdRelyingPartyMvc project, I was able to get a ClaimRequest for Email to work with Google. However, when I tried to add OpenID to my own project, the ClaimResponse always comes back null. I'm wondering if there is a project or environment setting ...

NHibernate conversation with ASP.NET+IoC+PostSharp?

Does anybody know a good example of how an NHibernate conversation can be used in a Web context (ASP.NET or ASP.NET MVC) using an IoC container and AOP? Personally, I use Castle/Windsor and PostSharp, but I will appreciate everything that points me to the right direction. ...

Rendering the field name in an EditorTemplate (rendered through EditorFor())

I'm currently building the Admin back-end for a website in ASP.NET MVC. In an ASP.NET MVC application, I've started using the 'EditorFor' helper method like so: <div id="content-edit" class="data-form"> <p> <%= Html.LabelFor(c => c.Title) %> <%= Html.TextBoxFor(c => c.Title)%> </p> <p> <%= Html.Label...

Strange route problem in ASP.NET MVC - default route not hit

I have this two routes currently in my application after decommenting out many other ones. Let me first explain that I have quite a big application already but have come to a problem where my application does not start at the root url anymore. If I set starting page to default.aspx then webapp starts at (example) http://localhost:55421/...

Why is my MVC site asking for logon?

Hi, I have created a ASP.NET MVC app and changed from the dev server to the local IIS server by clicking on Create Virtual Directory and also changing managed pipeline mode to integrated. But now when I run the app it shows the logon page. Why, this is my web.config??? <?xml version="1.0"?> <configuration> <system.web> <httpHan...

Html.ActionLink : div as target

Hello, I use this menu : http://www.stunicholls.com/menu/jquery-menutree.html I piece of this menu is : <li><a href="#url">MyItem</a></li> I replace by this : <li><%= Html.ActionLink("MyItem", "Index", "ControllerName")%></li> I'd like show the result in "MyDiv" <div id="MyDiv"> </div> How can I do this ? thanks, ...