MVC :: Creating A Custom ViewEngine

Jan 15, 2011

I am woking on a MVC project which require me to put all controllers, models and views into a folder called Mvc instead of the project root, I created a custom viewengine, here is the code:


My Application_Start:


It does not work, when I request [URL], I got: The view 'Index' or its master could not be found. The following locations were searched:


I expect the custom viewengine to find the view at: ~/Mvc/Views/Home/Index.aspx

View 1 Replies

Similar Messages:

MVC :: Upgrade An 3 Project With Aspx Viewengine To Razor Viewengine

Jan 18, 2011

I have upgraded my MVC2 project to MVC3 project and now I want to change the viewengine from standard aspx to the Razor viewengine. I have tested to create a new MVC3 project with the Razor viewengine and this works just fine, but now I want to uppgrade my existing MVC3 aspx viewengine project to a project with the Razor viewengine.

View 17 Replies

MVC :: Extending The RazorViewEngine For Custom ViewEngine?

Dec 9, 2010

I were following the tutorial at this page of how to build my own view engine: [URL] And in hope of just extending the existing RazorViewEngine I made some changes to the code in the tutorial...


The thing is that now when I run my site..I get the following error: CS0246: The type or namespace name 'WebMatrix' could not be found (are you missing a using directive or an assembly reference?) and I just cant find a way to solve this..I have added the references.

View 4 Replies

Custom Server Controls :: Hide A Method While Creating Custom Control By Inheriting WebControl?

Nov 29, 2010

I am creating a custom control by inheriting a server control, say LinkButton. There are properties like "BorderColor" available in LinkButton. Let's say, I don't want this particular property to be available when I create an instance of the custom control.

I want to completely hide this particular property (I don't want to override it but disable it.)

My code is as follows:


View 3 Replies

Custom Server Controls :: Creating A Custom Control?

Mar 3, 2010


View 4 Replies

MVC :: Where Does The EditorTemplates Go In Razor Viewengine

Nov 24, 2010

I've just installed the new MVC3 RC ,and have no idea about where the *.ascx template stuffs live in?

View 1 Replies

Creating Custom Objects For Wcf?

Oct 2, 2010

I have an existing web application that uses EF and POCO objects. I want to improve the client experience by exposing some of my objects through WCF(JSON). I have this working fine but where I am unsure is how to handle derived objects(not sure if that is the correct term) or IEnumerable anonymous objects if you will.

Let's say I have 3 tables structured like so:







This is obviously a one-to-many type relationship. I have my navigation properties setup correctly and getting strongly typed object properties works great. However, how do I send serialized anonymous type object(s) over the wire. Like an object that sends all instances that are equal to groupid=1 and include the names of the template and the object.Am I missing something or do I have to create another class object for WCF that would look like this:

WCF Object


I guess I could alter my tables to account for this but that seems wrong too. I know that IEnumerable objects can't be serialized and I know that throw away objects are probably not the way to go either. I want to do this the right way but I am not sure how to go about it.

View 1 Replies

MVC :: Creating A Custom AuthorizeAttribute?

Jun 3, 2010

I thought about creating a custom AuthorizeAttribute that will prevent logged in users calling a action ( [UnAuthorized] so to speak)

Tried creating a custom AuthorizeAttribute and override the AuthorizeCore method, but not sure this is the right approach.

(does not work anyhow...get an error telling me "no suitable method found to override")


View 7 Replies

Dynamic Attribute Value In MVC 3 With Razor Viewengine

Jan 18, 2011

how i can write

<input type="checkbox" name="@var.ID"/>

if i use it it never work. how i can done it. it's render as well as i write in code. it's not worked as well scottgu define in their blog

View 2 Replies

Implement For Each Delegate In Razor Viewengine?

Feb 22, 2011

The following code works for webform view engine.

<% Model.Categories.ForEach(x => { %>
<li><a href="#">@x.Name</a></li>
<% }) %>

I wrote the above code as below in razor view:

@Model.Categories.ForEach(x => {
<li><a href="#">@x.Name</a></li>

But this doesn't work. Is there any way to achieve this in razor view?

View 2 Replies

MVC :: Bind Method To Viewengine At Runtime

Apr 29, 2010

I've read about how I can create a custom viewengine however is it possible to load an assembly which has a method decorated by my own custom attribute say..[RenderWithView], then I dynamically invoke that method and apply a view engine to it, finally returning the html?

View 3 Replies

C# - Creating A Custom Framework Extension?

Feb 21, 2011

What is the best way to go about creating a custom framework for

We have several enterprise level ecommerce websites all running from completely seperate code bases. What I'd like to do is standardise the common components (session management/urlrewriting/surge control etc) and integrate them into the .net framework at the highest level possible and in a way that my developers cannot (easily) make changes.

I've considered creating a common assembly and just referencing that in each of the solutions but this still relies on the developer wiring up the httphandlers/modules and implementing the basepage design pattern for each individual page/masterpage.

View 1 Replies

Creating A Custom Button In A ListView?

Feb 24, 2011

I have a Results.aspx page that displays the resulting records queried using a SqlDataSource object via a ListView. I want to add a "View" button that will appear next to each record, and when clicked will take me to a separate page that will display details about that record. How do I accomplish this?


I have tried what you said, citronas and here's what I've come up with:


Unfortunately nothing actually I missing something?

Edit -- Fixed

I was missing something! I had CommandName equal to my method name instead of OnCommand. I took out CommandName, kept the argument bit and replaced CommandName with OnCommand. Everything works now, but what would I ever need CommandName for?

View 1 Replies

MVC :: Creating Custom HtmlHelper Method

Mar 9, 2011

I have created a custom html helper as follow:


In my View, I am using it like this:


However, for some reason nothing gets rendered!

View 4 Replies

Configuration :: Creating Custom Web Setup?

Dec 8, 2010

I don't know is this correct forum for asking this question or not, but i need it very urgently ,please help me out.I need to create a website setup with the following actions.1. Primarily it should first check whether IIS is installed in local machine or not, if IIS is not installed then it should give an Error Message.2. If IIS is present it should Start Installing with all the Content Files and Web Files and Class Files.3. After Installing all the files in IIS it should ask for the Connection String i.e. from where and which database should be taken as connection string, and it should set this connection string in web.config.4. After all this process it should ask for default page to be opened i.e. Which page should be started as first page.5. Then it should automatically open that website with default set page in browser , to check whether it is working fine or not.

View 3 Replies

C# - Creating A Custom Datatype In Umbraco?

Jul 5, 2010

I am trying to create a custom datatype. The intention being a dropdown list. As of right now, I can access the control I created but no properties or values are showing up within it. Just the blank drop down.

public partial class usercontrols_admin_customDataType_CountryDropDown :
public string umbracoValue;
protected void Page_Load(object sender, EventArgs e)
if (Page.IsPostBack)
DataSet ds = new DataSet();
FormFieldBuilder countries = new FormFieldBuilder();
ds = countries.GetAllCountries();
ddCountries.DataSource = ds;
ddCountries.DataTextField = ds.Tables[0].Columns["DisplayName"].ToString();
ddCountries.DataValueField = ds.Tables[0].Columns["guiCountryID"].ToString();
#region IUsercontrolDataEditor Members
public object value
return ddCountries.SelectedValue;
if (value != null)
ddCountries.SelectedValue = value.ToString();

View 1 Replies

Dynamical Creating Custom Control?

Aug 23, 2010

I created user control and want to add it to page. I use next code:

Controls_MultiTextInput cc = new Controls_MultiTextInput();

But control doesn't appear on page. What is wrong?

View 2 Replies

C# - Viewengine Not Looking Into Areas For Views In Mvc3 Upgrade?

Mar 10, 2011

i'm upgrading my mvc app to the MVC 3 from mvc 2. I had everything set up so that there were no areas, but now i have to move the old application into its own area so i can start a new one. The new area is working great, but for some reason, when i try to go into the area where the old app was, it looks for the views to be in the views folder in the root of the app, instead of in the views folder in the area.

View 2 Replies

MVC :: Razor Viewengine Breaks Actionfilter When Renderaction Is Used

Dec 17, 2010

I am using Actionfilter to globally filter our HTML comments from all action methods and in all controllers. It simply overrides OnActionExecuting and runs the response through a regex to filter the comments. I am also using RenderAction to render some more complicated widgets in my website. There is no caching in place, I just use Renderactionto keep my code as simple possible.

When calling RenderAction from within a Razor View, I get an error message telling me that "Filtering is not allowed". The problem does not occur when calling RenderAction from within an aspx View. It only occurs when calling RenderAction from within a Razor View. In case it matters: the view being rendered is implemented with ASPX. Is this a bug or a known limitation?

View 6 Replies

Make A Section Optional With The Mvc Razor ViewEngine?

Feb 4, 2011

I have a Page.cshtml similar to the following (that does not work):

Layout = "../Shared/Layouts/_Layout.cshtml";
var mycollection = (ViewBag.TheCollection as IQueryable<MyCollectionType>);

content here

@if (mycollection != null && mycollection.Count() > 0)
@section ContentRight
<ul class="stuff">
@foreach (MyCollectionType item in mycollection )
<li class="stuff-item">@item.Name</li>

As I said, this does not work. I want to not define the section if there's nothing in the collection. Is there any way to have something like this work? If not, what are my other options? I'm very new to this Razor ViewEngine. Edit In my layout i have:

<div class="right">

what i don't want is the div to output when the section is empty.

View 2 Replies

MVC ViewEngine ViewLocationCache.GetViewLocation Returns Null?

Jan 24, 2010

I am following Chris Pietschmann's solution for theming in ASP.NET MVC.

One thing I have noticed is that the view name is not being retrieved from the ViewLocationCache on subsequent requests. I am using ASP.NET MVC 2.0 RC

When the following code is executed:

this.ViewLocationCache.InsertViewLocation(controllerContext.HttpContext, cacheKey, virtualPath);

and I hover over this.ViewLocationCache it just returns {System.Web.Mvc.NullViewLocationCache} - suggesting nothing was added?

View 1 Replies

MVC :: Creating A Custom Actionresult In 2 To Generate JSONP

Jan 3, 2011

i have a need to generate JSONP using MVC 2 for a 3rd party App...It seems there is no actionresult for this OOTB in MVC 2 so i need to create a custom one..i found the following article on such here; [URL] My first question is...Where do i put the custom actionresult code? Secondly...How can i use this to new JSONP actionresult to return data from my data model? Currently , my current JSON actionresult (remember..i need JSONP) looks like this;


How can i use the new JSONP Actionresult to return db.GetTopGainers()?

View 2 Replies

Security :: Creating Custom Registration And Login

Oct 20, 2010

I'm working on a project that requires registration and login. I know that ASP.NET provides login controls to get that job easily done. However, I'd like to implement custom registration and login. I mean my own registration and login forms and my own database. I've researched before posting this topic, but found nothing useful teaching me how to implement those functions. Can you guys tell me the way to implement them using LINQ and VB? OR can you give me the URL of the tutorial teaches exactly what I want?

View 2 Replies

Web Forms :: Creating A Custom Wizard Using Panels?

Dec 6, 2010

I have a need to create a custom wizard, without using the wizard control. What I am attempting to create is something similar to this post:


The only problem is that I need to attach CSS to the previous steps that is different from the next step, and different from the current step. So I created a <UL> for the menu, but how to dynamically attach css to the different <ul> elements and assign 3 classes: previous, current & next based on the step the user is on?

View 2 Replies

Creating A Custom Isntall Package For A Web Application?

Mar 26, 2010

'm in need to create a custom installation package that I can distribute to my clients, where the installation of ASP.NET web applicationwould be as automated as possible. To do this I'm looking for custom install that has the following capability:- Copy and deploy files to desired location- Create a virtual application on the IIS- Connect to the SQL server and create the SQL database.- Ability to enter custom data such as the license key

View 2 Replies

Copyrights 2005-15, All rights reserved