'System.Web.Mvc.HtmlHelper' does not contain a definition for 'Calendar'



Please anybody tell me what this error. I use asp.net MVC Beta. This error showing in gridview too how to rectify it?

Compiler Error Message: CS1061: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'Calendar' and no extension method 'Calendar' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?) Source Error: Line 8: Line 9:

Mvc Calendar 1: Simplest Calendar

Line 10: <%= Html.Calendar() %> Line 11: Line 12:





10/20/2008 7:28:38 AM
asp.net.mvc 4300 articles. 0 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 0

 OOTB, MVC beta 1 doesn't contain html helper for calendar, so I presume you created extension method on your own.

In beta 1, all OOTB HTML helpers are now in separate System.Web.Mvc.Html assembly, so you might want to change your extension method code in order to resolve this. In fact, this is probably a source for this error. Try replacing


 Complete code sample for extension method, controller, and view would be very helpful here.

Dragan Panjkov
[http://blogpanjkov.qsh.eu/] [http://www.microsoft.com/bih]

10/20/2008 8:44:43 AM

Here's an example of adding a new HtmlHelper extension method called Calendar.


1    namespace MvcApplication7
2    {
3        using System;
4        using System.Web.Mvc;
6        public static class CalendarHelper
7        {
8            public static string Calendar(this HtmlHelper htmlHelper)
9            {
10               return String.Empty;
11           }
12       }
13   }


In Web.Config, add the following the namespace of the extension method to the <Pages> element.

1        <pages>
2          <controls>
3            <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
4            <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
5          </controls>
7          <namespaces>
8            <add namespace="Microsoft.Web.Mvc"/>
9            <add namespace="System.Web.Mvc"/>
10           <add namespace="System.Web.Mvc.Ajax"/>
11           <add namespace="System.Web.Mvc.Html"/>
12           <add namespace="System.Web.Routing"/>
13           <add namespace="System.Linq"/>
14           <add namespace="System.Collections.Generic"/>
15           <add namespace="MvcApplication7"/>
16         </namespaces>
17       </pages>
In your view, you can now write something like <% =Html.Calendar() %>. Note that you might have to rebuild the project before the new method will be picked up by the intellisense
10/20/2008 10:58:26 PM

 @jeloff: i asked @Ambikaa to post his code that is throwing an error... but thanks. I hope it will help to resolve that error :)

Dragan Panjkov
[http://blogpanjkov.qsh.eu/] [http://www.microsoft.com/bih]

10/22/2008 6:01:22 AM

Similar Artilces:

'System.Web.Mvc.HtmlHelper' does not contain a definition for 'GridView'
Hi,Using this article http://weblogs.asp.net/stephenwalther/archive/2008/06/24/asp-net-mvc-tip-8-create-an-asp-net-mvc-gridview-helper-method.aspxi have created gridview based on that but, the error follows  Compiler Error Message: CS1928: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'GridView' and the best extension method overload 'VMLBlogsite.Helpers.GridExtensions.GridView(System.Web.Mvc.HtmlHelper, System.Data.Linq.ITable)' has some invalid arguments Source Error: Line 8: Simple Grid Line 9: Line 10: <%= Html.GridV...

MVC BETA: 'SubmitButton' is not a member of 'System.Web.Mvc.HtmlHelper'
I created a new MVC BEta Project and copied over a few views and I get this error now:'SubmitButton' is not a member of 'System.Web.Mvc.HtmlHelper' It's not even listed as an option for me - what the hell? Anyone know what I am doing wrong here? I believe this HtmlHelper is only availbe in the Futures assembly.  The Futures assembly is no longer referenced automatically.  It is a seperate download. It looks like this HtmlHelper wasn't doing a whole lot for you in this case anyway.  Why not just write: <input type="submit" id="Sea...

Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/ GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

CS0117: 'System.Web.UI.WebControls.Calendar' does not contain a definition for 'SelectedValue'
am I missing some class info somewhere perhaps?Any ideas or suggestions would be appreciated!error being thrown here:Line 16:                   Calendar1.SelectedValue = ("DueDate"); here is my current code:<%@ Page EnableViewState="true" Language="C#" AutoEventWireup="true" Inherits="CommunityServer.Controls.CSThemePage" MasterPageFile="tasks.Master" %><%@ Import Namespace="CommunityServer.Components" %><%@ Register T...

'System.Web.HttpRequest' does not contain a definition for 'form'
Hello all. .NET 2.0 newbie here.... What I'm trying to do is learn how to use the LoadVars() in actionscript. Here is the .NET / C#/ html code  1 <form id="form1" runat="server"> 2 <div> 3 <% 4 if (Request.form("userName") == "Cameron") 5 { 6 Response.Write("&aspvar=it is You!"); 7 } 8 else 9 { 10 Response.Write("&aspvar=you are not Cameron&"); 11 } 12 13 %> ...

'System.Web.UI.Control' does not contain a definition for 'DataItem'
Hi, I am recieving this error: 'System.Web.UI.Control' does not contain a definition for 'DataItem' What iam trying to do is when a user clicks the hyperlink column in the datagrid then the ID of that user is send to another page and I need to run the Query or something and bind the Label on the page 2 with the name of the Person. So I am using the HTML view and writing something like this : '<%# DataBinder.Eval(Container.DataItem,"Name") %> ' here is my code behind file so how can i bind the Name of the person with the label: private void Page_Lo...

'System.Web.UI.Control' does not contain a definition for 'DataItem'
Hi, I am getting this error does anyone knows how to solve this :DHighOnCodingWanna get high! Show us the code that produces this error. Other than the exactness of the error, which explains what is exactly happening, we can't see why this is happening without seeing your code.David WierMCP/ASPInsiderASPNet101.com - where to look first!Please Vote for ASPNet101 - 'Best Community Resource'!Control Grouper - easily control properties for multiple controls with one control!Calendar Express - The Best HTML Calendar Generator on the web!(Please 'Mark as Answer' when i...

Cannot implicitly convert type 'System.Xml.XmlNode' to 'XmlNode' and 'XmlNode' does not contain a definition for 'AppendChild'
Hi,      XmlNode t = xmlDoc.SelectSingleNode("/NewDataSet/Table1/Template");//Cannot implicitly convert type 'System.Xml.XmlNode' to 'XmlNode'//        XmlText textNode1 = xmlDoc.CreateTextNode("hello");                       XmlElement ChildofTemplate = xmlDoc.CreateElement("ChildTemplate");//'XmlNode' does not contain a definition for 'AppendChild'// ...

'System.Web.UI.WebControls.Panel' does not contain a definition for 'drpData'
Hi i have the following problem: Compiler Error Message: CS0117: 'System.Web.UI.WebControls.Panel' does not contain a definition for 'drpData' Source Error: Line 59: strvBilled = filepath.ToString(); Line 60: strvPris = tbvPris.Text; Line 61: strvKategori = tbvKategori.drpData.SelectedItem.Value.ToString(); Line 62: strSQL = "INSERT INTO varelist (vNummer, vNavn, vBeskriv, vBilled, vPris, vKategori) Values ("; Line 63: strSQL += strvNummer + ", '"; It should come from this list: <asp:panel ID="tbvKategori" r...

CS0117: 'System.Web.Security.MembershipUser' does not contain a definition for 'UserName'
Hi, I export my dataBase1 on others dataBase2. But , now, I have this errors.   Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0117: 'System.Web.Security.MembershipUser' does not contain a definition for 'UserName'Source Error: Line 77: { Line 78: MembershipUser memberUser = Membership.GetUser(); Line 79: if (memberUser.UserName != null && ...

'System.Web.UI.WebControls.Label' does not contain a definition for 'Invoke'
I am making an asyncronous call to a web service. When the callback happens and my delegate is called, I want to set a text value on a label on my page. In order to do this I need to use Label1.Invoke -- However, when I compile this I get an error'System.Web.UI.WebControls.Label' does not contain a definition for 'Invoke'I thought all controls should have an Invoke method on it.. I don't understand why I get this error? Any one experience the same thing or have any clue as to what is going on? // we must invoke to get back to the UI thread...this.Label1.Invoke(new La...

'System.Web.UI.WebControls.TextBox' does not contain a definition for 'InnerHtml' and ...
Hi,I have the problems (the following is one of those) with the codes below.Error 4 'System.Web.UI.WebControls.TextBox' does not contain a definition for 'InnerHtml' and no extension method 'InnerHtml' accepting a first argument of type 'System.Web.UI.WebControls.TextBox' could be found (are you missing a using directive or an assembly reference?)  Here is the markup file of 'Start.aspx' <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Start.aspx.cs" Inherits="Newsite._Default" %...

Error 39 'System.Data.DataRow' does not contain a definition for 'Item'
for (i = 0; i <= ds.Tables[0].Rows.Count - 1; i++) { categoryID = ds.Tables[0].Rows[i].Item["categoryID"]; name = ds.Tables[0].Rows[i].Item["name"]; string catID = Convert.ToString(categoryID); ///Change made by me ddlCategory.Items.Add(new ListItem(name, catID)); qry = "Select count(categoryID) from categories where active = 'True' AND parentID=" + categoryID + ""; countCategories = objDB.getScalar(qry);       i get this errorIf the going seems easy, You are going DownHill... I've got the solution what you have to ...

Web resources about - 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'Calendar' - asp.net.mvc

Resources last updated: 1/11/2016 10:11:23 AM