[CLOSED] How to send paramters to DirectEventArgs when Calendar EventClick/DayClick?

  1. #1

    [CLOSED] How to send paramters to DirectEventArgs when Calendar EventClick/DayClick?

    Hi Team

    If i want to send the date of a cell when i click on that day/cell and i want to add some events for that day, then how can i know for which day/cell i clicked and how to added events to that cell from code behind?

    Thanks in advacne...
    Mohan
    Last edited by Daniil; Nov 26, 2010 at 3:43 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please look at the example.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void CalendarPanel_DayClick(object sender, DirectEventArgs e)
        {
            string d = e.ExtraParams["date"];
            DateTime date = DateTime.Parse(d);
            Event myEvent = new Event()
            {
                Title = "New Event",
                StartDate = date,
                EndDate = date,
                IsAllDay = true,
                CalendarId = 1
            };
            this.CalendarPanel1.EventStore.Events.Add(myEvent);
            this.CalendarPanel1.EventStore.DataBind();
        }
    </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" Height="500">
                    <EventStore runat="server">
                        <Events>
                            <ext:Event 
                                Title="My event" 
                                StartDate="2010/11/10" 
                                EndDate="2010/11/10" 
                                IsAllDay="true"
                                CalendarId="1" />
                        </Events>
                    </EventStore>
                    <DirectEvents>
                        <DayClick OnEvent="CalendarPanel_DayClick" Before="extraParams.date = dt;" />
                    </DirectEvents>
                </ext:CalendarPanel>
            </Items>
        </ext:Viewport>
        </form>
    </body>
    </html>
    Please not that event which is added during direct event is not exist after invoking DataBind() in another direct event.

    So, you have to store events in a global object (Session, Cache).
  3. #3
    Hi Danil

    It did'nt work, earlier i have raised a post (http://forums.ext.net/showthread.php?11177-How-to-add-event-from-code-behind-button-click-(DirectEventArgs)&p=45228#post45228) which is nearly same kind of this, and I have sent my code to support team. So far i haven't received any solution.

    If you want to download the code, here is the link http://support.ext.net/discussions/h...89ba628db17c56

    Regards
    Mohan
  4. #4
    Hi,

    I review that thread and the code you provided.

    Please update from SVN (http://svn.ext.net/premium/trunk) and reind the EventStore instead CalendarPanel
    Please clarify did you update from SVN?

    Just replace dlls with updated ones and your code will work fine. I've tested exactly the code you sent with the latest dlls and the things became fine.
  5. #5
    ThanQ Daniil :)

    Its working fine now

    Regards
    Mohan

Similar Threads

  1. Replies: 4
    Last Post: Mar 27, 2012, 12:47 PM
  2. Replies: 3
    Last Post: Mar 21, 2012, 3:14 PM
  3. [CLOSED] How to open specific window in same dayClick in Calendar?
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 12, 2011, 3:53 PM
  4. [CLOSED] How to add event from code behind button click (DirectEventArgs)
    By mohan.bizbites in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 26, 2010, 5:58 AM
  5. Replies: 1
    Last Post: Jun 07, 2010, 7:19 AM

Tags for this Thread

Posting Permissions