ComponentOne AppView for ASP.NET WebForms
Tutorials / Creating an Event Planning Application / Step 2 of 4: Creating the Application's Web Forms / b. Creating the Calendar
In This Topic
    b. Creating the Calendar
    In This Topic
    1. From your Calendar folder, open the Index.aspx file by double-clicking on it.
    2. Add the following assembly registries:

      To write code in Source View

      <%@ Register Assembly="C1.Web.Wijmo.Controls.4" Namespace="C1.Web.Wijmo.Controls.C1EventsCalendar" TagPrefix="cc1" %>
      <%@ Register Assembly="C1.Web.Wijmo.Controls.4" Namespace="C1.Web.Wijmo.Controls.C1AppView" TagPrefix="cc1" %>
    3. Locate the <form> </form> tags on your page and insert the following markup between them:

      To write code in Source View

      <asp:EntityDataSource ID="EventPlannerEntityDataSource" runat="server"
                    OnContextCreating="EventPlannerEntityDataSource_ContextCreating"
                    EntitySetName="Events">
             </asp:EntityDataSource>
             <cc1:C1AppViewPage ID="C1AppViewPage1" runat="server" HeaderTitle="Event Calendar">
                    <Header ID="Header1" runat="server">
                           <Template>
                                 <a href="../Main.aspx" data-icon="back">Back</a>
                                 <h2>Event Calendar</h2>
                           </Template>
                    </Header>
                    <Content ID="Content1" runat="server">
                           <Template>
                                 <cc1:C1EventsCalendar ID="C1EventsCalendar1" runat="server">
                                        <DataStorage>
                                               <EventStorage DataSourceID="EventPlannerEntityDataSource">
                                                      <Mappings>
                                                             <IdMapping MappingName="Id" />
                                                             <SubjectMapping MappingName="Subject" />
                                                             <StartMapping MappingName="Start" />
                                                             <EndMapping MappingName="End" />
                                                             <LocationMapping MappingName="Location" />
                                                             <DescriptionMapping MappingName="Description" />
                                                      </Mappings>
                                               </EventStorage>
                                        </DataStorage>
                                 </cc1:C1EventsCalendar>
                           </Template>
                    </Content>
             </cc1:C1AppViewPage>
    4. Right-click the page and select View Code from the list. Check the namespaces you reference in the code. They should resemble the following. Note that the reference to the Models needs to resemble the last reference in the list, using your application's name:

      To write code in C#

      C#
      Copy Code
      using System;
      using System.Collections.Generic;
      using System.Data.Entity.Infrastructure;
      using System.Diagnostics;
      using System.Linq;
      using System.Web;
      using System.Web.UI;
      using System.Web.UI.WebControls;
      using YourApplicationName.Models;
    5. Add the following below the Page_Load event:

      To write code in C#

      C#
      Copy Code
      protected void EventPlannerEntityDataSource_ContextCreating(object sender, EntityDataSourceContextCreatingEventArgs e)
      {
      var db = EventAction.GetEventDb();
      e.Context = (db as IObjectContextAdapter).ObjectContext;
      }
      }
      }