[CLOSED] How to add event from code behind button click (DirectEventArgs)

  1. #1

    [CLOSED] How to add event from code behind button click (DirectEventArgs)

    Hello Team,

    I have page with Calendar,Collection Employees (combobox) and a buttton (Show Calendar).

    I will select an employee from the combobox and click on the button to add the respective employee events to the calender.....

    Please find my code below

    <ext:CalendarPanel ID="CalendarPanel1" runat="server" Region="Center" ActiveIndex="2" Border="false">
            <EventStore ID="eventStore1" runat="server">
            </EventStore>
    </ext:CalendarPanel>
    
    protected void btnShow_Click(object sender, DirectEventArgs e)
        {
            --- code to get a list of events for the employee
    
            EventStore eventStore = (EventStore)this.CalendarPanel1.EventStore;
    
            List<EmployeeEvents> lstEmpEvents = GetEmployeeEventsByEmployeeId(employeeId);
    
            foreach (EmployeeEvents empEvent in lstEmpEvents )
            {
                Event myEvent = new Event();
                myEvent.Title = empEvent.EventName;
                myEvent.StartDate = empEvent.StartDate;
                myEvent.EndDate = empEvent.EndDate;
                eventStore.Events.Add(myEvent);
            }
            this.CalendarPanel1.DataBind();
        }
    Regards
    Mohan
    Last edited by Daniil; Nov 26, 2010 at 3:43 PM. Reason: Please use [CODE] tags, [CLOSED]
  2. #2
    Hi,

    Please use [CODE ] tags, see #3
    http://forums.ext.net/showthread.php?10205-More-Information-Required

    Regarding the question

    Please investigate this simple sample code, see Page_Load.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            EventStore eventStore = new EventStore { ID = "EventStore1" };
            Event myEvent = new Event { Title="Me event", StartDate = DateTime.Now, EndDate = DateTime.Now };
            eventStore.Events.Add(myEvent);
            this.CalendarPanel1.EventStore = eventStore;
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:Viewport runat="server" Layout="fit">
            <Items>
                <ext:CalendarPanel ID="CalendarPanel1" runat="server" />
            </Items>
        </ext:Viewport>
        </form>
    </body>
    </html>
  3. #3
    Hi,

    Please update from SVN (http://svn.ext.net/premium/trunk) and reind the EventStore instead CalendarPanel
    protected void btnShow_Click(object sender, DirectEventArgs e)
    {
    --- code to get a list of events for the employee
    
    EventStore eventStore = (EventStore)this.CalendarPanel1.EventStore;
    List<EmployeeEvents> lstEmpEvents = GetEmployeeEventsByEmployeeId(employeeId);
    
    foreach (EmployeeEvents empEvent in lstEmpEvents )
    {
    Event myEvent = new Event();
    myEvent.Title = empEvent.EventName;
    myEvent.StartDate = empEvent.StartDate;
    myEvent.EndDate = empEvent.EndDate;
    eventStore.Events.Add(myEvent);
    }
    eventStore.DataBind();
    }
  4. #4
    This thread is related with this one
    http://forums.ext.net/showthread.php...Click-DayClick

Similar Threads

  1. [CLOSED] Adding Click Event in code-behind
    By cwolcott in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 20, 2012, 5:02 PM
  2. Click Listener to Button from Code-Behind
    By Alexx in forum 1.x Help
    Replies: 7
    Last Post: Jul 26, 2011, 11:26 AM
  3. Replies: 5
    Last Post: Jan 06, 2011, 9:58 PM
  4. [CLOSED] Adding Click Event In Code Behind
    By rcaunt in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Oct 07, 2009, 9:12 AM
  5. [CLOSED] Radio button click event,
    By Etisbew in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 02, 2009, 7:56 AM

Tags for this Thread

Posting Permissions