jquery full calender with recurrence option in Asp.net

Hi, For showing events in calender we can use other caleder control to show data events.
so insted we can use jquery full calender to show events with recurrence option.
here is my code.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Jqueryevents.aspx.cs" Inherits="ScoringStar.Admin.Jqueryevents" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<!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 id="Head1" runat="server"><title>Events page</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="expires" content="-1" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="X-UA-Compatible" content="IE=8;FF=3;OtherUA=4" />
    <link rel='stylesheet' type='text/css' href='fullcalendar/fullcalendar.css' />
    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.js" type="text/javascript" />
    </script>
    <script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript" />
    </script>
    <link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/redmond/jquery-ui.css"
        rel="stylesheet" type="text/css" />
    <script type='text/javascript' src='fullcalendar/fullcalendar.min.js' />
    </script>
    <script src="https://github.com/douglascrockford/JSON-js/raw/master/json2.js" type="text/javascript" />
    </script>
    <script src="jquery/jquery-ui-timepicker-addon-0.6.2.min.js" type="text/javascript" />
    </script>
    <script type="text/javascript">
        var currentUpdateEvent;
        var addStartDate;
        var addEndDate;
        var globalAllDay;

        function selectDate(start, end, allDay) {

            $('#addDialog').dialog('open');


            $("#addEventStartDate").text("" + start.toLocaleString());
            $("#addEventEndDate").text("" + end.toLocaleString());


            addStartDate = start;
            addEndDate = end;
            globalAllDay = allDay;
            //alert(allDay);

        }

        $(document).ready(function () {
            DisplayCalendar();
            $('#updatedialog').dialog({
                autoOpen: false,
                width: 670,
                height: 600,
                buttons: {
                    "update": function () {
                        //alert(currentUpdateEvent.title);
                        var ChkBox = document.getElementById("chkupdateallday");
                        if (ChkBox.checked == true) {
                            var Venue = document.getElementById("ddlupdatevenue");
                            var eventToAdd = {
                                id:$("#eventId").val(),
                                title: $("#txtupdatesub").val(),
                                description: $("#txtupdatedesc").val(),
                                start: $("#txtupdatestime").val(),
                                end: $("#txtupdateedate").val(),
                                venue: Venue.options[Venue.selectedIndex].text,
                                starttime: "",
                                endtime: ""
                            };
                        }
                        else {
                            var Starttime = document.getElementById("ddlupdatestime");
                            var Endtime = document.getElementById("ddlupdateetime");
                            var Venue = document.getElementById("ddlupdatevenue");
                            var eventToAdd = {
                                id: $("#eventId").val(),
                                title: $("#txtupdatesub").val(),
                                description: $("#txtupdatedesc").val(),
                                start: $("#txtupdatestime").val(),
                                end: $("#txtupdateedate").val(),
                                EventVenue: Venue.options[Venue.selectedIndex].text,
                                EventStarttime: Starttime.options[Starttime.selectedIndex].text,
                                EventEndtime: Endtime.options[Endtime.selectedIndex].text
                            };
                        }
                        var ChkBox = document.getElementById("rbtnupdatehourly");
                        if (ChkBox.checked == true) {
                            var eventToAdd1 = {
                                FREQ: "HOURLY",
                                INTERVAL: $("#TextBox12").val(),
                                BYSETPOS: "",
                                BYDAY: "",
                                BYMONTH: "",
                                BYMONTHDAY: ""
                            };

                        }
                        var ChkBox = document.getElementById("RadioButton6");
                        if (ChkBox.checked == true) {
                            var rbtnEveryday = document.getElementById("RadioButton10");
                            if (rbtnEveryday.checked == true) {
                                var eventToAdd1 = {
                                    FREQ: "DAILY",
                                    INTERVAL: $("#TextBox13").val(),
                                    BYSETPOS: "",
                                    BYDAY: "MO,TU,WE,TH,FR,SA,SU",
                                    BYMONTH: "",
                                    BYMONTHDAY: ""
                                };
                            }
                            else {
                                var eventToAdd1 = {
                                    FREQ: "DAILY",
                                    INTERVAL: 1,
                                    BYSETPOS: "",
                                    BYDAY: "MO,TU,WE,TH,FR",
                                    BYMONTH: "",
                                    BYMONTHDAY: ""
                                };
                            };
                        }
                        var ChkBox = document.getElementById("RadioButton7");
                        if (ChkBox.checked == true) {
                            var eventToAdd1 = {
                                FREQ: "WEEKLY",
                                INTERVAL: $("#TextBox14").val(),
                                BYSETPOS: "",
                                BYMONTH: "",
                                BYMONTHDAY: ""
                            };
                            var eventToday1 = {
                                BYDAY1: ""
                            };
                            //                            $.extend(eventToAdd1, eventToday1);
                            var ChkBox2 = document.getElementById("CheckBox10");
                            if (ChkBox2.checked == true) {
                                var eventToday2 = {
                                    BYDAY2: "SA"
                                };
                                $.extend(eventToday1, eventToday2);
                            }

                            var ChkBox3 = document.getElementById("CheckBox9");
                            if (ChkBox3.checked == true) {
                                var eventToday3 = {
                                    BYDAY3: "FR"
                                };
                                $.extend(eventToday1, eventToday3);
                            }

                            var ChkBox4 = document.getElementById("CheckBox8");
                            if (ChkBox4.checked == true) {
                                var eventToday4 = {
                                    BYDAY4: "TH"
                                };
                                $.extend(eventToday1, eventToday4);
                            }

                            var ChkBox5 = document.getElementById("CheckBox6");
                            if (ChkBox5.checked == true) {
                                var eventToday5 = {
                                    BYDAY5: "WD"
                                };
                                $.extend(eventToday1, eventToday5);
                            }

                            var ChkBox6 = document.getElementById("CheckBox5");
                            if (ChkBox6.checked == true) {
                                var eventToday6 = {
                                    BYDAY6: "TU"
                                };
                                $.extend(eventToday1, eventToday6);
                            }

                            var ChkBox7 = document.getElementById("CheckBox4");
                            if (ChkBox7.checked == true) {
                                var eventToday7 = {
                                    BYDAY7: "Mo"
                                };
                                $.extend(eventToday1, eventToday7);
                            }

                            var ChkBox8 = document.getElementById("CheckBox3");
                            if (ChkBox8.checked == true) {
                                var eventToday8 = {
                                    BYDAY8: "SU"
                                };
                                $.extend(eventToday1, eventToday8);
                            }
                            $.extend(eventToAdd1, eventToday1);
                            $.extend(eventToAdd, eventToAdd1);
                        }
                        var ChkBox = document.getElementById("RadioButton8");
                        if (ChkBox.checked == true) {
                            var rbtnEveryday = document.getElementById("RadioButton5");
                            if (rbtnEveryday.checked == true) {
                                var eventToAdd1 = {
                                    FREQ: "MONTHLY",
                                    INTERVAL: $("#TextBox9").val(),
                                    BYSETPOS: "",
                                    BYDAY: "",
                                    BYMONTH: "",
                                    BYMONTHDAY: $("#TextBox10").val()
                                };
                            }
                            else {
                                var Monthlynum = document.getElementById("DropDownList4");
                                var Monthlyday = document.getElementById("DropDownList5");
                                var eventToAdd1 = {
                                    FREQ: "MONTHLY",
                                    INTERVAL: $("#TextBox11").val(),
                                    BYSETPOS: Monthlynum.options[Monthlynum.selectedIndex].text,
                                    BYDAY: Monthlyday.options[Monthlyday.selectedIndex].text,
                                    BYMONTH: "",
                                    BYMONTHDAY: ""
                                };
                            };
                        }
                        var ChkBox = document.getElementById("RadioButton9");
                        if (ChkBox.checked == true) {
                            var rbtnEveryday = document.getElementById("RadioButton13");
                            if (rbtnEveryday.checked == true) {
                                var Yearlymonth = document.getElementById("DropDownList6");
                                var eventToAdd1 = {
                                    FREQ: "YEARLY",
                                    INTERVAL: 1,
                                    BYSETPOS: "",
                                    BYDAY: "MO,TU,WE,TH,FR,SA",
                                    BYMONTH: Yearlymonth.options[Yearlymonth.selectedIndex].text,
                                    BYMONTHDAY: $("#TextBox15").val()
                                };
                            }
                            else {
                                var Monthlynum = document.getElementById("DropDownList7");
                                var Monthlyday = document.getElementById("DropDownList8");
                                var Monthlyday2 = document.getElementById("DropDownList9");
                                var eventToAdd1 = {
                                    FREQ: "YEARLY",
                                    INTERVAL: 1,
                                    BYSETPOS: Monthlynum.options[Monthlynum.selectedIndex].text,
                                    BYDAY: Monthlyday.options[Monthlyday.selectedIndex].text,
                                    BYMONTH: Monthlyday2.options[Monthlyday2.selectedIndex].text,
                                    BYMONTHDAY: ""
                                };
                            };
                        }
                        $.extend(eventToAdd, eventToAdd1);

                        var ChkBox1 = document.getElementById("RadioButton15");
                        if (ChkBox1.checked == true) {
                            var eventToAdd2 = {
                                COUNT: 0,
                                UNTIL: ""
                            };
                            $.extend(eventToAdd, eventToAdd2);
                        }
                        var ChkBox2 = document.getElementById("RadioButton16");
                        if (ChkBox2.checked == true) {
                            var eventToAdd2 = {
                                COUNT: $("#TextBox16").val(),
                                UNTIL: ""
                            };
                            $.extend(eventToAdd, eventToAdd2);
                        }
                        var ChkBox3 = document.getElementById("RadioButton17");
                        if (ChkBox3.checked == true) {
                            var eventToAdd2 = {
                                COUNT: 0,
                                UNTIL: $("#TextBox17").val()
                            };
                            $.extend(eventToAdd, eventToAdd2);
                        }
                        PageMethods.UpdateEvent(eventToAdd, updateSuccess);
                        $(this).dialog("close");

                        currentUpdateEvent.title = $("#eventName").val();
                        currentUpdateEvent.description = $("#eventDesc").val();
                        $('#calendar').fullCalendar('updateEvent', currentUpdateEvent);


                    },
                    "delete": function () {

                        if (confirm("do you really want to delete this event?")) {

                            PageMethods.deleteEvent($("#eventId").val(), deleteSuccess);
                            $(this).dialog("close");
                            $('#calendar').fullCalendar('removeEvents', $("#eventId").val());
                        }

                    }

                }
            });

            //add dialog
            $('#addDialog').dialog({
                autoOpen: false,
                width: 670,
                height: 600,
                buttons: {
                    "Add": function () {

                        //alert("sent:" + addStartDate.format("dd-MM-yyyy hh:mm:ss tt") + "==" + addStartDate.toLocaleString());
                        var ChkBox = document.getElementById("chkAllday");
                        if (ChkBox.checked == true) {
                            var Venue = document.getElementById("ddlLocation");
                            var eventToAdd = {
                                title: $("#txtSubject").val(),
                                description: $("#addEventDesc").val(),
                                start: $("#txtStartdate").val(),
                                end: $("#txtEnddate").val(),
                                venue: Venue.options[Venue.selectedIndex].text,
                                starttime: "",
                                endtime: ""
                            };
                        }
                        else {
                            var Starttime = document.getElementById("ddlStarttime");
                            var Endtime = document.getElementById("ddlEndtime");
                            var Venue = document.getElementById("ddlLocation");
                            var eventToAdd = {
                                title: $("#txtSubject").val(),
                                description: $("#addEventDesc").val(),
                                start: $("#txtStartdate").val(),
                                end: $("#txtEnddate").val(),
                                EventVenue: Venue.options[Venue.selectedIndex].text,
                                EventStarttime: Starttime.options[Starttime.selectedIndex].text,
                                EventEndtime: Endtime.options[Endtime.selectedIndex].text
                            };
                        }
                        var ChkBox = document.getElementById("rbtnHourly");
                        if (ChkBox.checked == true) {
                            var eventToAdd1 = {
                                FREQ: "HOURLY",
                                INTERVAL: $("#updown").val(),
                                BYSETPOS: "",
                                BYDAY: "",
                                BYMONTH: "",
                                BYMONTHDAY: ""
                            };

                        }
                        var ChkBox = document.getElementById("rbtnDaily");
                        if (ChkBox.checked == true) {
                            var rbtnEveryday = document.getElementById("rbtnEveryday");
                            if (rbtnEveryday.checked == true) {
                                var eventToAdd1 = {
                                    FREQ: "DAILY",
                                    INTERVAL: $("#TextBox1").val(),
                                    BYSETPOS: "",
                                    BYDAY: "MO,TU,WE,TH,FR,SA,SU",
                                    BYMONTH: "",
                                    BYMONTHDAY: ""
                                };
                            }
                            else {
                                var eventToAdd1 = {
                                    FREQ: "DAILY",
                                    INTERVAL: 1,
                                    BYSETPOS: "",
                                    BYDAY: "MO,TU,WE,TH,FR",
                                    BYMONTH: "",
                                    BYMONTHDAY: ""
                                };
                            };
                        }
                        var ChkBox = document.getElementById("rbtnWeekly");
                        if (ChkBox.checked == true) {
                            var eventToAdd1 = {
                                FREQ: "WEEKLY",
                                INTERVAL: $("#TextBox2").val(),
                                BYSETPOS: "",
                                BYMONTH: "",
                                BYMONTHDAY: ""
                            };
                            var eventToday1 = {
                                BYDAY1: ""
                            };
                            //                            $.extend(eventToAdd1, eventToday1);
                            var ChkBox2 = document.getElementById("chkSaturday");
                            if (ChkBox2.checked == true) {
                                var eventToday2 = {
                                    BYDAY2: "SA"
                                };
                                $.extend(eventToday1, eventToday2);
                            }

                            var ChkBox3 = document.getElementById("chkFriday");
                            if (ChkBox3.checked == true) {
                                var eventToday3 = {
                                    BYDAY3: "FR"
                                };
                                $.extend(eventToday1, eventToday3);
                            }

                            var ChkBox4 = document.getElementById("chkThursday");
                            if (ChkBox4.checked == true) {
                                var eventToday4 = {
                                    BYDAY4: "TH"
                                };
                                $.extend(eventToday1, eventToday4);
                            }

                            var ChkBox5 = document.getElementById("chkWednesday");
                            if (ChkBox5.checked == true) {
                                var eventToday5 = {
                                    BYDAY5: "WD"
                                };
                                $.extend(eventToday1, eventToday5);
                            }

                            var ChkBox6 = document.getElementById("chkTuesday");
                            if (ChkBox6.checked == true) {
                                var eventToday6 = {
                                    BYDAY6: "TU"
                                };
                                $.extend(eventToday1, eventToday6);
                            }

                            var ChkBox7 = document.getElementById("chkMonday");
                            if (ChkBox7.checked == true) {
                                var eventToday7 = {
                                    BYDAY7: "Mo"
                                };
                                $.extend(eventToday1, eventToday7);
                            }

                            var ChkBox8 = document.getElementById("chkSunday");
                            if (ChkBox8.checked == true) {
                                var eventToday8 = {
                                    BYDAY8: "SU"
                                };
                                $.extend(eventToday1, eventToday8);
                            }
                            $.extend(eventToAdd1, eventToday1);
                            $.extend(eventToAdd, eventToAdd1);
                        }
                        var ChkBox = document.getElementById("rbtnMonthly");
                        if (ChkBox.checked == true) {
                            var rbtnEveryday = document.getElementById("RadioButton1");
                            if (rbtnEveryday.checked == true) {
                                var eventToAdd1 = {
                                    FREQ: "MONTHLY",
                                    INTERVAL: $("#TextBox3").val(),
                                    BYSETPOS: "",
                                    BYDAY: "",
                                    BYMONTH: "",
                                    BYMONTHDAY: $("#TextBox4").val()
                                };
                            }
                            else {
                                var Monthlynum = document.getElementById("ddlpnlMonthlynum");
                                var Monthlyday = document.getElementById("ddlpnlMonthlyday");
                                var eventToAdd1 = {
                                    FREQ: "MONTHLY",
                                    INTERVAL: $("#TextBox5").val(),
                                    BYSETPOS: Monthlynum.options[Monthlynum.selectedIndex].text,
                                    BYDAY: Monthlyday.options[Monthlyday.selectedIndex].text,
                                    BYMONTH: "",
                                    BYMONTHDAY: ""
                                };
                            };
                        }
                        var ChkBox = document.getElementById("rbtnYearly");
                        if (ChkBox.checked == true) {
                            var rbtnEveryday = document.getElementById("RadioButton3");
                            if (rbtnEveryday.checked == true) {
                                var Yearlymonth = document.getElementById("ddlpnlYearlymonth");
                                var eventToAdd1 = {
                                    FREQ: "YEARLY",
                                    INTERVAL: 1,
                                    BYSETPOS: "",
                                    BYDAY: "MO,TU,WE,TH,FR,SA",
                                    BYMONTH: Yearlymonth.options[Yearlymonth.selectedIndex].text,
                                    BYMONTHDAY: $("#TextBox4").val()
                                };
                            }
                            else {
                                var Monthlynum = document.getElementById("DropDownList1");
                                var Monthlyday = document.getElementById("DropDownList2");
                                var Monthlyday2 = document.getElementById("DropDownList3");
                                var eventToAdd1 = {
                                    FREQ: "YEARLY",
                                    INTERVAL: 1,
                                    BYSETPOS: Monthlynum.options[Monthlynum.selectedIndex].text,
                                    BYDAY: Monthlyday.options[Monthlyday.selectedIndex].text,
                                    BYMONTH: Monthlyday2.options[Monthlyday2.selectedIndex].text,
                                    BYMONTHDAY: ""
                                };
                            };
                        }
                        $.extend(eventToAdd, eventToAdd1);

                        var ChkBox1 = document.getElementById("rbtnEnddateno");
                        if (ChkBox1.checked == true) {
                            var eventToAdd2 = {
                                COUNT: 0
                            };
                            $.extend(eventToAdd, eventToAdd2);
                        }
                        var ChkBox2 = document.getElementById("rbtnEnddateafter");
                        if (ChkBox2.checked == true) {
                            var eventToAdd2 = {
                                COUNT: $("#TextBox7").val()
                            };
                            $.extend(eventToAdd, eventToAdd2);
                        }
                        var ChkBox3 = document.getElementById("rbtnEnddate");
                        if (ChkBox3.checked == true) {
                            var eventToAdd2 = {
                                COUNT: $("#TextBox8").val()
                            };
                            $.extend(eventToAdd, eventToAdd2);
                        }

                        PageMethods.addEvent(eventToAdd, deleteSuccess);
                      
                        $(this).dialog("close");
                        //                         }                       
                    }
                }
            });
        });

        function updateEvent(event, element) {
            //alert(event.description);

            if ($(this).data("qtip")) $(this).qtip("destroy");

            currentUpdateEvent = event;

            $('#updatedialog').dialog('open');
            $("#txtupdatesub").val(event.title);
            $("#eventDesc").val(event.description);
            $("#eventId").val(event.id);
            $("#txtupdatestime").val($.fullCalendar.parseDate(event.start));
            //$("#txtupdatestime").val($.fullCalendar.formatDate(event.start," d-M-Y"));
            $("#txtupdateedate").val(event.end);
//            $("#txtupdatesub").val(event.title);
//            $("#txtupdatedesc").val(event.description);
//            $("#eventId").val(event.id);
//            $("#txtupdatestime").val( event.start);
//            $("#txtupdateedate").val( event.end);
//            $("#txtupdatesub").val(event.EventStarttime);
//            $("#txtupdatedesc").val(event.EventEndtime);
//            $("#ddlupdatevenue").val(event.EventVenue);
//            if (event.end === null) {
//                $("#eventEnd").text("");
//            }
//            else {
//                $("#eventEnd").text("" + event.end.toLocaleString());
//            }

        }
        function addSuccess(updateResult) {
            // alert(updateResult);
        }
        function updateSuccess(updateResult) {
            //alert(updateResult);
        }

        function deleteSuccess(deleteResult) {
            //alert(deleteResult);
        }
        function DisplayCalendar() {
            $.ajax({
                type: "POST",
                contentType: "application/json",
                data: "{}",
                url: "Jqueryevents.aspx/GetEvents",
                dataType: "json",
                success: function (data) {
                    $('div[id*=calendar]').fullCalendar({
                        header: {
                            left: 'prev,next today',
                            center: 'title',
                            right: 'month,agendaWeek,agendaDay'
                        },
                        select: selectDate,
                        eventClick: updateEvent,
                        editable: true,
//                        droppable: true,
//                        draggable: true,
                        selectable: true,
                        selectHelper: true,
                        eventTextColor: 'Yellow',
                        eventBackgroundColor: 'purple',
                        events:
        $.map(data.d, function (item, i) {
            var event = new Object();
            event.id = item.EventID;
            event.start = item.StartDate;
            event.end = item.EndDate;
            event.title = item.EventName;
            event.allDay = false;
            return event;
        })
                     
                    });

                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    debugger;
                }
            });
        }
    </script>
    <script type="text/javascript" src="scripts/date.js"></script>
    <!--[if IE]><script type="text/javascript" src="scripts/jquery.bgiframe.min.js"></script><![endif]-->
    <!-- jquery.datePicker.js -->
    <script type="text/javascript" src="scripts/jquery.datePicker.js"></script>
    <!-- datePicker required styles -->
    <link rel="stylesheet" type="text/css" media="screen" href="styles/datePicker.css">
    <!-- page specific scripts -->
    <script type="text/javascript">
        ///////////////--------add dailog------------------------//////////////////////
        function OpenChildWindow() {
            //open a new dialog window
            var sFeatures = "dialogHeight: 440px;";
            sFeatures += "dialogWidth: 710px;";
            sFeatures += "center: yes;";
            sFeatures += "edge: sunken;";
            sFeatures += "scroll: no;";
            sFeatures += "status: yes;";
            sFeatures += "resizeable: no;";
            var url = 'SelectMembers.aspx';

            entryWindow = window.showModalDialog(url, 'ChildForm', sFeatures);
            if (entryWindow == true) {
                //this would trigger the update panels update as the button is part of the UP
                window.document.getElementById('btnHiddenForUpdate').click();
            }

        }
    
        function CHeck() {
            var ChkBox = document.getElementById("CheckBox7");
            if (ChkBox.checked == true) {
                $("#div_id").show();
            }
            else {
                $("#div_id").hide();
            }
        }
        function CHAllday() {
            var ChkBox = document.getElementById("chkAllday");
            if (ChkBox.checked == true) {
                $("#ddlStarttime").hide();
                $("#ddlEndtime").hide();
            }
            else {
                $("#ddlStarttime").show();
                $("#ddlEndtime").show();
            }
        }
        ///////////////--------updagte dailog------------------------//////////////////////
        function OpenChildWindow1() {
            //open a new dialog window
            var sFeatures = "dialogHeight: 440px;";
            sFeatures += "dialogWidth: 710px;";
            sFeatures += "center: yes;";
            sFeatures += "edge: sunken;";
            sFeatures += "scroll: no;";
            sFeatures += "status: yes;";
            sFeatures += "resizeable: no;";
            var url = 'SelectMembers.aspx';

            entryWindow = window.showModalDialog(url, 'ChildForm', sFeatures);
            if (entryWindow == true) {
                //this would trigger the update panels update as the button is part of the UP
                window.document.getElementById('Button1').click();
            }

        }
        function CHeck1() {
            var ChkBox = document.getElementById("CheckBox2");
            if (ChkBox.checked == true) {
                $("#div3").show();
            }
            else {
                $("#div3").hide();
            }
        }
        function CHAllday1() {
            var ChkBox = document.getElementById("chkupdateallday");
            if (ChkBox.checked == true) {
                $("#ddlupdatestime").hide();
                $("#ddlupdateetime").hide();
            }
            else {
                $("#ddlupdatestime").show();
                $("#ddlupdateetime").show();
            }
        }
        $(document).ready(function () {
            ///////////////--------add dailog------------------------//////////////////////
            $('#rbtnHourly').change(function () {
                var ChkBox = document.getElementById("rbtnHourly");
                if (ChkBox.checked == true) {

                    $("#pnlMonthly").hide();
                    $("#pnlWeekly").hide();
                    $("#pnlDaily").hide();
                    $("#pnlHourly").show();
                    $("#pnlYearly").hide();
                }
            });
            $('#rbtnDaily').change(function () {
                var ChkBox = document.getElementById("rbtnDaily");
                if (ChkBox.checked == true) {

                    $("#pnlMonthly").hide();
                    $("#pnlWeekly").hide();
                    $("#pnlDaily").show();
                    $("#pnlHourly").hide();
                    $("#pnlYearly").hide();
                }
            });
            $('#rbtnWeekly').change(function () {
                var ChkBox = document.getElementById("rbtnWeekly");
                if (ChkBox.checked == true) {

                    $("#pnlMonthly").hide();
                    $("#pnlWeekly").show();
                    $("#pnlDaily").hide();
                    $("#pnlHourly").hide();
                    $("#pnlYearly").hide();
                }
            });
            $('#rbtnMonthly').change(function () {
                var ChkBox = document.getElementById("rbtnMonthly");
                if (ChkBox.checked == true) {

                    $("#pnlMonthly").show();
                    $("#pnlWeekly").hide();
                    $("#pnlDaily").hide();
                    $("#pnlHourly").hide();
                    $("#pnlYearly").hide();
                }
            });
            $('#rbtnYearly').change(function () {
                var ChkBox = document.getElementById("rbtnYearly");
                if (ChkBox.checked == true) {

                    $("#pnlMonthly").hide();
                    $("#pnlWeekly").hide();
                    $("#pnlDaily").hide();
                    $("#pnlHourly").hide();
                    $("#pnlYearly").show();
                }
            });
            ///////////////--------updagte dailog------------------------//////////////////////
            $('#rbtnupdatehourly').change(function () {
                var ChkBox = document.getElementById("rbtnupdatehourly");
                if (ChkBox.checked == true) {

                    $("#Div5").hide();
                    $("#Div6").hide();
                    $("#Div7").hide();
                    $("#Div4").show();
                    $("#Div8").hide();
                }
            });
            $('#RadioButton6').change(function () {
                var ChkBox = document.getElementById("RadioButton6");
                if (ChkBox.checked == true) {

                    $("#Div5").show();
                    $("#Div6").hide();
                    $("#Div7").hide();
                    $("#Div4").hide();
                    $("#Div8").hide();
                }
            });
            $('#RadioButton7').change(function () {
                var ChkBox = document.getElementById("RadioButton7");
                if (ChkBox.checked == true) {

                    $("#Div5").hide();
                    $("#Div6").show();
                    $("#Div7").hide();
                    $("#Div4").hide();
                    $("#Div8").hide();
                }
            });
            $('#RadioButton8').change(function () {
                var ChkBox = document.getElementById("RadioButton8");
                if (ChkBox.checked == true) {

                    $("#Div5").hide();
                    $("#Div6").hide();
                    $("#Div7").show();
                    $("#Div4").hide();
                    $("#Div8").hide();
                }
            });
            $('#RadioButton9').change(function () {
                var ChkBox = document.getElementById("RadioButton9");
                if (ChkBox.checked == true) {

                    $("#Div5").hide();
                    $("#Div6").hide();
                    $("#Div7").hide();
                    $("#Div4").hide();
                    $("#Div8").show();
                }
            });
        });
    </script>
    <style type='text/css'>
        body
        {
            margin-top: 40px;
            text-align: center;
            font-size: 14px;
            font-family: "Lucida Grande" ,Helvetica,Arial,Verdana,sans-serif;
        }
        #calendar
        {
            width: 900px;
            margin: 0 auto;
        }
        /* css for timepicker */
        .ui-timepicker-div dl
        {
            text-align: left;
        }
        .ui-timepicker-div dl dt
        {
            height: 25px;
        }
        .ui-timepicker-div dl dd
        {
            margin: -25px 0 10px 65px;
        }
        .style1
        {
            width: 100%;
        }
       
        /* table fields alignment*/
        .alignRight
        {
            text-align: right;
            padding-right: 10px;
            padding-bottom: 10px;
        }
        .alignLeft
        {
            text-align: left;
            padding-bottom: 10px;
        }
        .date-pick
        {
            position: relative;
            z-index: 100000;
        }
    </style>
    <script src="Scripts/ui.spinner.js" type="text/javascript"></script>
    <script type="text/javascript">
        jQuery().ready(function ($) {
            $('#updown').spinner({ min: -100, max: 100 });
            $('#TextBox1').spinner({ min: -100, max: 100 });
            $('#TextBox2').spinner({ min: -100, max: 100 });
            $('#TextBox3').spinner({ min: -100, max: 100 });
            $('#TextBox4').spinner({ min: -100, max: 100 });
            $('#TextBox5').spinner({ min: -100, max: 100 });
            $('#TextBox6').spinner({ min: -100, max: 100 });
            $('#TextBox7').spinner({ min: -100, max: 100 });
            $('#TextBox12').spinner({ min: -100, max: 100 });
            $('#TextBox13').spinner({ min: -100, max: 100 });
            $('#TextBox9').spinner({ min: -100, max: 100 });
            $('#TextBox10').spinner({ min: -100, max: 100 });
            $('#TextBox11').spinner({ min: -100, max: 100 });
            $('#TextBox15').spinner({ min: -100, max: 100 });
            $('#TextBox16').spinner({ min: -100, max: 100 });
            $('#TextBox14').spinner({ min: -100, max: 100 });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" EnablePartialRendering="true">
    </asp:ScriptManager>
    <div id='calendar'>
    </div>
    <div id='diverror'>
    </div>
    <div id="updatedialog" style="font: 70% 'Trebuchet MS', sans-serif; margin: 5px;" title="Update or Delete Event">
         <table cellpadding="0px" cellspacing="5" class="style1" style="width: 640px;">
            <tr>
                <td align="left">
                    Subject:
                </td>
                <td align="left">
                    <asp:TextBox ID="txtupdatesub" runat="server" Width="305"></asp:TextBox>
                </td>
                <td align="left">
                    <div id="div2" runat="server" class="ErrorClass">
                    </div>
                     <span id="eventEnd"></span>
                    <input type="hidden" id="eventId" />
                </td>
            </tr>
            <tr>
                <td align="left">
                    Description:
                </td>
                <td align="left" colspan="2">
                    <textarea id="txtupdatedesc" cols="55" rows="3"></textarea>
                </td>
            </tr>
            <tr>
                <td align="left">
                    Start time:
                </td>
                <td align="left">
                    <asp:TextBox ID="txtupdatestime" runat="server"></asp:TextBox>
                    <asp:Image ID="Image2" runat="server" Height="15" Width="15" />
                    <asp:CalendarExtender ID="CalendarExtender3" runat="server" Enabled="True"
                        TargetControlID="txtupdatestime" PopupButtonID="Image2">
                    </asp:CalendarExtender>
                    <asp:DropDownList ID="ddlupdatestime" runat="server">
                        <asp:ListItem Value="0">8:00 am</asp:ListItem>
                        <asp:ListItem Value="1">9:00 am</asp:ListItem>
                        <asp:ListItem Value="2">10:00 am</asp:ListItem>
                        <asp:ListItem Value="1">11:00 am</asp:ListItem>
                        <asp:ListItem Value="2">12:00 am</asp:ListItem>
                        <asp:ListItem Value="1">01:00 pm</asp:ListItem>
                        <asp:ListItem Value="2">02:00 pm</asp:ListItem>
                        <asp:ListItem Value="1">03:00 pm</asp:ListItem>
                        <asp:ListItem Value="2">04:00 pm</asp:ListItem>
                        <asp:ListItem Value="1">05:00 pm</asp:ListItem>
                        <asp:ListItem Value="2">06:00 pm</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td align="left" style="width: 95px;">
                    <asp:CheckBox ID="chkupdateallday" runat="server" Text="All day" onclick="CHAllday1()" Checked="false" />
                </td>
            </tr>
            <tr>
                <td align="left">
                    End time:
                </td>
                <td align="left" colspan="2">
                    <asp:TextBox ID="txtupdateedate" runat="server"></asp:TextBox>
                    <asp:Image ID="Image3" runat="server" Height="15" Width="15" />
                    <asp:CalendarExtender ID="CalendarExtender4" runat="server" Enabled="True" TargetControlID="txtupdateedate"
                        PopupButtonID="Image3">
                    </asp:CalendarExtender>
                    <asp:DropDownList ID="ddlupdateetime" runat="server">
                        <asp:ListItem Value="0">8:00 am</asp:ListItem>
                        <asp:ListItem Value="1">9:00 am</asp:ListItem>
                        <asp:ListItem Value="2">10:00 am</asp:ListItem>
                        <asp:ListItem Value="3">11:00 am</asp:ListItem>
                        <asp:ListItem Value="4">12:00 am</asp:ListItem>
                        <asp:ListItem Value="5">01:00 pm</asp:ListItem>
                        <asp:ListItem Value="6">02:00 pm</asp:ListItem>
                        <asp:ListItem Value="7">03:00 pm</asp:ListItem>
                        <asp:ListItem Value="8">04:00 pm</asp:ListItem>
                        <asp:ListItem Value="9">05:00 pm</asp:ListItem>
                        <asp:ListItem Value="10">06:00 pm</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td align="left">
                    <asp:Label ID="Label3" runat="server" Text="Venue :"></asp:Label>
                </td>
                <td align="left" colspan="2">
                    <asp:DropDownList ID="ddlupdatevenue" runat="server">
                        <asp:ListItem Value="1">Home</asp:ListItem>
                        <asp:ListItem Value="2">Away</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td align="left">
                    <asp:Literal ID="Literal3" runat="server" Text="Send Invites:" />
                </td>
                <td align="left">
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                            <div style="overflow-y: scroll; width: 300px; height: 100px">
                                <asp:CheckBoxList ID="CheckBoxList2" runat="server" RepeatLayout="Flow" CausesValidation="false"
                                    RepeatColumns="3" RepeatDirection="Horizontal" CssClass="checkBoxList" AutoPostBack="true"
                                    OnSelectedIndexChanged="chklst2_SelectedIndexChanged">
                                </asp:CheckBoxList>
                            </div>
                            <input type="button" id="Button1" runat="server" style="display: none"
                                onserverclick="btnHiddenForUpdate2_ServerClick" />
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
                <td align="left" style="width: 95px;">
                    <%--<asp:Button ID="btnSelectMembers" runat="server" Text="Select" OnClientClick="NewWindow()" />--%>
                    <a href="javascript:OpenChildWindow1();">Select members</a>
                </td>
            </tr>
            <tr>
                <td colspan="3" align="left">
                    <%-- <input type="checkbox" id="checkbox1" runat="server"/>Recurrence--%>
                    <asp:CheckBox ID="CheckBox2" runat="server" onclick="CHeck1()" Text="Recurrence" />
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    <div id="div3" style="display: none; height: 50px;">
                        <asp:Panel ID="Panel1" runat="server" BorderColor="Black" BorderWidth="1px" Width="600px">
                            <table cellpadding="0" cellspacing="10" width="590px">
                                <tr>
                                    <td style="width: 100px" align="right">
                                        <table cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td style="vertical-align: top; width: 100px; height: 1px" align="left">
                                                    <asp:RadioButton ID="rbtnupdatehourly" Checked="true" runat="server" GroupName="Recurrencesup"
                                                        Text="Hourly" />
                                                </td>
                                                <%-- <td style="vertical-align: top" ddlStarttime>
                                                    <asp:Literal ID="Literal2" runat="server" Text="Hourly" />
                                                </td>--%>
                                            </tr>
                                            <tr>
                                                <td style="vertical-align: top; width: 100px; height: 1px" align="left">
                                                    <asp:RadioButton ID="RadioButton6" runat="server" GroupName="Recurrencesup" Text="Daily" />
                                                </td>
                                                <%--<td style="vertical-align: top" align="left">
                                                    <asp:Literal ID="Literal3" runat="server" Text="Daily" />
                                                </td>--%>
                                            </tr>
                                            <tr>
                                                <td style="vertical-align: top; width: 100px; height: 1px" align="left">
                                                    <asp:RadioButton ID="RadioButton7" runat="server" GroupName="Recurrencesup" Text="Weekly" />
                                                </td>
                                                <%-- <td style="vertical-align: top" align="left">
                                                    <asp:Literal ID="Literal4" runat="server" Text="Weekly" />
                                                </td>--%>
                                            </tr>
                                            <tr>
                                                <td style="vertical-align: top; width: 100px; height: 1px" align="left">
                                                    <asp:RadioButton ID="RadioButton8" runat="server" GroupName="Recurrencesup" Text="Monthly" />
                                                </td>
                                                <%-- <td style="vertical-align: top" align="left">
                                                    <asp:Literal ID="Literal5" runat="server" Text="Monthly" />
                                                </td>--%>
                                            </tr>
                                            <tr>
                                                <td style="vertical-align: top; width: 100px; height: 1px" align="left">
                                                    <asp:RadioButton ID="RadioButton9" runat="server" GroupName="Recurrencesup" Text="Yearly" />
                                                </td>
                                                <%-- <td style="vertical-align: top" align="left">
                                                    <asp:Literal ID="Literal6" runat="server" Text="Yearly" />
                                                </td>--%>
                                            </tr>
                                        </table>
                                    </td>
                                    <td style="vertical-align: top" align="left" colspan="2">
                                        <div id="Div4">
                                            <table style="margin-top: 10px;" width="100%">
                                                <tr>
                                                    <td align="left">
                                                        <asp:Literal ID="Literal4" runat="server" Text="Every" />
                                                        <asp:TextBox ID="TextBox12" runat="server" ClientIDMode="Static" Text="1" Width="30px">
                                                        </asp:TextBox>
                                                        <asp:Literal ID="Literal5" runat="server" Text="hour(s)" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                        <div id="Div5" style="display: none">
                                            <table style="margin-top: 10px;" width="100%">
                                                <tr>
                                                    <td align="left" style="vertical-align: top">
                                                        <asp:RadioButton ID="RadioButton10" runat="server"  GroupName="pnlDailyup" />
                                                        <asp:Literal ID="Literal6" runat="server" Text="Every" />
                                                        <asp:TextBox ID="TextBox13" runat="server" ClientIDMode="Static" Text="1" Width="30px">
                                                        </asp:TextBox>
                                                        <asp:Literal ID="Literal25" runat="server" Text=" day(s)" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td align="left" style="vertical-align: top">
                                                        <asp:RadioButton ID="RadioButton11" runat="server" GroupName="pnlDailyup" />
                                                        <asp:Literal ID="Literal26" runat="server" Text="Every weekday" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                        <div id="Div6" style="display: none">
                                            <table style="margin-top: 10px;" width="100%">
                                                <tr>
                                                    <td style="vertical-align: top" align="left">
                                                        <asp:Literal ID="Literal27" runat="server" Text="Recur every" />
                                                        <asp:TextBox ID="TextBox14" runat="server" ClientIDMode="Static" Text="1" Width="30px">
                                                        </asp:TextBox>
                                                        <asp:Literal ID="Literal28" runat="server" Text="week(s) on" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="vertical-align: top" align="left">
                                                        <table>
                                                            <tr>
                                                                <td style="vertical-align: top; width: 15px">
                                                                    <asp:CheckBox ID="CheckBox3" runat="server" />
                                                                </td>
                                                                <td style="vertical-align: top">
                                                                    <asp:Label ID="label4" runat="server" Text="Sunday" />
                                                                </td>
                                                                <td style="vertical-align: top; width: 15px">
                                                                    <asp:CheckBox ID="CheckBox4" runat="server" />
                                                                </td>
                                                                <td style="vertical-align: top">
                                                                    <asp:Literal ID="Literal29" runat="server" Text="Monday" />
                                                                </td>
                                                                <td style="vertical-align: top; width: 15px">
                                                                    <asp:CheckBox ID="CheckBox5" runat="server" />
                                                                </td>
                                                                <td style="vertical-align: top">
                                                                    <asp:Literal ID="Literal30" runat="server" Text="Tuesday" />
                                                                </td>
                                                                <td style="vertical-align: top; width: 15px">
                                                                    <asp:CheckBox ID="CheckBox6" runat="server" />
                                                                </td>
                                                                <td style="vertical-align: top">
                                                                    <asp:Literal ID="Literal31" runat="server" Text="Wednesday" />
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td style="vertical-align: top; width: 15px">
                                                                    <asp:CheckBox ID="CheckBox8" runat="server" />
                                                                </td>
                                                                <td style="vertical-align: top">
                                                                    <asp:Literal ID="Literal32" runat="server" Text="Thursday" />
                                                                </td>
                                                                <td style="vertical-align: top; width: 15px">
                                                                    <asp:CheckBox ID="CheckBox9" runat="server" />
                                                                </td>
                                                                <td style="vertical-align: top">
                                                                    <asp:Literal ID="Literal33" runat="server" Text="Friday" />
                                                                </td>
                                                                <td style="vertical-align: top; width: 15px">
                                                                    <asp:CheckBox ID="CheckBox10" runat="server" Checked="true" />
                                                                </td>
                                                                <td style="vertical-align: top">
                                                                    <asp:Literal ID="Literal34" runat="server" Text="Saturday" />
                                                                </td>
                                                                <td>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                       <div id="Div7" style="display: none">
                                            <table style="margin-top: 10px;" width="100%">
                                                <tr>
                                                    <td align="left">
                                                        <asp:RadioButton ID="RadioButton5" runat="server"  GroupName="pblMonthlyup" />
                                                        <asp:Literal ID="Literal35" runat="server" Text="Day" />
                                                        <asp:TextBox ID="TextBox9" runat="server" ClientIDMode="Static" Text="1" Width="30px">
                                                        </asp:TextBox>
                                                        <asp:Literal ID="Literal36" runat="server" Text="of Every" />
                                                        <asp:TextBox ID="TextBox10" runat="server" ClientIDMode="Static" Text="1" Width="30px">
                                                        </asp:TextBox>
                                                        <asp:Literal ID="Literal37" runat="server" Text=" month (s)" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td align="left">
                                                        <asp:RadioButton ID="RadioButton12" runat="server" GroupName="pblMonthlyup" />
                                                        <asp:Literal ID="Literal38" runat="server" Text="The" />
                                                        <asp:DropDownList ID="DropDownList4" runat="server">
                                                            <asp:ListItem Value="1">first</asp:ListItem>
                                                            <asp:ListItem Value="2">second</asp:ListItem>
                                                            <asp:ListItem Value="3">third</asp:ListItem>
                                                            <asp:ListItem Value="4">fourth</asp:ListItem>
                                                            <asp:ListItem Value="5">last</asp:ListItem>
                                                        </asp:DropDownList>
                                                        <asp:DropDownList ID="DropDownList5" runat="server">
                                                            <asp:ListItem Value="1">day</asp:ListItem>
                                                            <asp:ListItem Value="2">weekday</asp:ListItem>
                                                            <asp:ListItem Value="3">weekend</asp:ListItem>
                                                            <asp:ListItem Value="4">Sunday</asp:ListItem>
                                                            <asp:ListItem Value="5">Monday</asp:ListItem>
                                                            <asp:ListItem Value="6">Tuesday</asp:ListItem>
                                                            <asp:ListItem Value="7">Wednesday</asp:ListItem>
                                                            <asp:ListItem Value="8">Thursday</asp:ListItem>
                                                            <asp:ListItem Value="9">Friday</asp:ListItem>
                                                            <asp:ListItem Value="10">Saturday</asp:ListItem>
                                                        </asp:DropDownList>
                                                        <asp:Literal ID="Literal39" runat="server" Text="of every" />
                                                        <asp:TextBox ID="TextBox11" runat="server" ClientIDMode="Static" Text="1" Width="30px">
                                                        </asp:TextBox>
                                                        <asp:Literal ID="Literal40" runat="server" Text="month(s)" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                        <div id="Div8" style="display: none">
                                            <table style="margin-top: 10px;" width="100%">
                                                <tr>
                                                    <td align="left">
                                                        <asp:RadioButton ID="RadioButton13" runat="server" GroupName="pnlYearlyup" />
                                                        <%-- </td>
                                                    <td>--%>
                                                        <asp:DropDownList ID="DropDownList6" runat="server">
                                                            <asp:ListItem Value="1">January</asp:ListItem>
                                                            <asp:ListItem Value="2">February</asp:ListItem>
                                                            <asp:ListItem Value="3">March</asp:ListItem>
                                                            <asp:ListItem Value="4">April</asp:ListItem>
                                                            <asp:ListItem Value="5">May</asp:ListItem>
                                                            <asp:ListItem Value="6">June</asp:ListItem>
                                                            <asp:ListItem Value="7">July</asp:ListItem>
                                                            <asp:ListItem Value="8">Augest</asp:ListItem>
                                                            <asp:ListItem Value="9">September</asp:ListItem>
                                                            <asp:ListItem Value="10">October</asp:ListItem>
                                                            <asp:ListItem Value="11">November</asp:ListItem>
                                                            <asp:ListItem Value="12">December</asp:ListItem>
                                                        </asp:DropDownList>
                                                        <asp:TextBox ID="TextBox15" runat="server" ClientIDMode="Static" Text="1" Width="30px">
                                                        </asp:TextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td align="left">
                                                        <asp:RadioButton ID="RadioButton14" runat="server" GroupName="pnlYearlyup" />
                                                        <asp:Literal ID="Literal41" runat="server" Text="The" />
                                                        <asp:DropDownList ID="DropDownList7" runat="server">
                                                            <asp:ListItem Value="1">first</asp:ListItem>
                                                            <asp:ListItem Value="2">second</asp:ListItem>
                                                            <asp:ListItem Value="3">third</asp:ListItem>
                                                            <asp:ListItem Value="4">fourth</asp:ListItem>
                                                            <asp:ListItem Value="5">last</asp:ListItem>
                                                        </asp:DropDownList>
                                                        <asp:DropDownList ID="DropDownList8" runat="server">
                                                            <asp:ListItem Value="1">day</asp:ListItem>
                                                            <asp:ListItem Value="2">weekday</asp:ListItem>
                                                            <asp:ListItem Value="3">weekend</asp:ListItem>
                                                            <asp:ListItem Value="4">Sunday</asp:ListItem>
                                                            <asp:ListItem Value="5">Monday</asp:ListItem>
                                                            <asp:ListItem Value="6">Tuesday</asp:ListItem>
                                                            <asp:ListItem Value="7">Wednesday</asp:ListItem>
                                                            <asp:ListItem Value="8">Thursday</asp:ListItem>
                                                            <asp:ListItem Value="9">Friday</asp:ListItem>
                                                            <asp:ListItem Value="10">Saturday</asp:ListItem>
                                                        </asp:DropDownList>
                                                        of
                                                        <asp:DropDownList ID="DropDownList9" runat="server">
                                                            <asp:ListItem Value="1">January</asp:ListItem>
                                                            <asp:ListItem Value="2">February</asp:ListItem>
                                                            <asp:ListItem Value="3">March</asp:ListItem>
                                                            <asp:ListItem Value="4">April</asp:ListItem>
                                                            <asp:ListItem Value="5">May</asp:ListItem>
                                                            <asp:ListItem Value="6">June</asp:ListItem>
                                                            <asp:ListItem Value="7">July</asp:ListItem>
                                                            <asp:ListItem Value="8">Augest</asp:ListItem>
                                                            <asp:ListItem Value="9">September</asp:ListItem>
                                                            <asp:ListItem Value="10">October</asp:ListItem>
                                                            <asp:ListItem Value="11">November</asp:ListItem>
                                                            <asp:ListItem Value="12">December</asp:ListItem>
                                                        </asp:DropDownList>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="3">
                                        <hr />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 100px" align="left">
                                        <asp:RadioButton ID="RadioButton15" Checked="true" runat="server" GroupName="Enddate1"
                                            Text="No end date" />
                                    </td>
                                    <td align="left">
                                        <asp:RadioButton ID="RadioButton16" runat="server" GroupName="Enddate1" Text="End after" />
                                        <asp:TextBox ID="TextBox16" runat="server" ClientIDMode="Static" Text="1" Width="30px" />
                                        <asp:Literal ID="Literal42" runat="server" Text="occurrences" />
                                    </td>
                                    <td style="width: 250px" align="left">
                                        <asp:RadioButton ID="RadioButton17" runat="server" GroupName="Enddate1" Text="End by" />
                                        <asp:TextBox ID="TextBox17" runat="server" Width="70px"></asp:TextBox>
                                        <asp:Image ID="Image4" runat="server" Height="15" Width="15" />
                                        <asp:CalendarExtender ID="CalendarExtender5" runat="server" Enabled="True" TargetControlID="TextBox17"
                                            PopupButtonID="Image4">
                                        </asp:CalendarExtender>
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <div id="addDialog" style="font: 70% 'Trebuchet MS', sans-serif; margin: 5px;" title="Add Event">
        <table cellpadding="0px" cellspacing="5" class="style1" style="width: 640px;">
            <tr>
                <td align="left">
                    Subject:
                </td>
                <td align="left">
                    <asp:TextBox ID="txtSubject" runat="server" Width="305"></asp:TextBox>
                </td>
                <td align="left">
                    <div id="div1" runat="server" class="ErrorClass">
                    </div>
                </td>
            </tr>
            <tr>
                <td align="left">
                    Description:
                </td>
                <td align="left" colspan="2">
                    <textarea id="addEventDesc" cols="55" rows="3"></textarea>
                </td>
            </tr>
            <tr>
                <td align="left">
                    Start time:
                </td>
                <td align="left">
                    <asp:TextBox ID="txtStartdate" runat="server"></asp:TextBox>
                    <asp:Image ID="imgStartdate" runat="server" Height="15" Width="15" />
                    <asp:CalendarExtender ID="TextBox1_CalendarExtender" runat="server" Enabled="True"
                        TargetControlID="txtStartdate" PopupButtonID="imgStartdate">
                    </asp:CalendarExtender>
                    <asp:DropDownList ID="ddlStarttime" runat="server">
                        <asp:ListItem Value="0">8:00 am</asp:ListItem>
                        <asp:ListItem Value="1">9:00 am</asp:ListItem>
                        <asp:ListItem Value="2">10:00 am</asp:ListItem>
                        <asp:ListItem Value="3">11:00 am</asp:ListItem>
                        <asp:ListItem Value="4">12:00 am</asp:ListItem>
                        <asp:ListItem Value="5">01:00 pm</asp:ListItem>
                        <asp:ListItem Value="6">02:00 pm</asp:ListItem>
                        <asp:ListItem Value="7">03:00 pm</asp:ListItem>
                        <asp:ListItem Value="8">04:00 pm</asp:ListItem>
                        <asp:ListItem Value="9">05:00 pm</asp:ListItem>
                        <asp:ListItem Value="10">06:00 pm</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td align="left" style="width: 95px;">
                    <asp:CheckBox ID="chkAllday" runat="server" Text="All day" onclick="CHAllday()" Checked="false" />
                </td>
            </tr>
            <tr>
                <td align="left">
                    End time:
                </td>
                <td align="left" colspan="2">
                    <asp:TextBox ID="txtEnddate" runat="server"></asp:TextBox>
                    <asp:Image ID="imgEnddate" runat="server" Height="15" Width="15" />
                    <asp:CalendarExtender ID="CalendarExtender1" runat="server" Enabled="True" TargetControlID="txtEnddate"
                        PopupButtonID="imgEnddate">
                    </asp:CalendarExtender>
                    <asp:DropDownList ID="ddlEndtime" runat="server">
                        <asp:ListItem Value="0">8:00 am</asp:ListItem>
                        <asp:ListItem Value="1">9:00 am</asp:ListItem>
                        <asp:ListItem Value="2">10:00 am</asp:ListItem>
                        <asp:ListItem Value="3">11:00 am</asp:ListItem>
                        <asp:ListItem Value="4">12:00 am</asp:ListItem>
                        <asp:ListItem Value="5">01:00 pm</asp:ListItem>
                        <asp:ListItem Value="6">02:00 pm</asp:ListItem>
                        <asp:ListItem Value="7">03:00 pm</asp:ListItem>
                        <asp:ListItem Value="8">04:00 pm</asp:ListItem>
                        <asp:ListItem Value="9">05:00 pm</asp:ListItem>
                        <asp:ListItem Value="10">06:00 pm</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td align="left">
                    <asp:Label ID="Label2" runat="server" Text="Venue :"></asp:Label>
                </td>
                <td align="left" colspan="2">
                    <asp:DropDownList ID="ddlLocation" runat="server">
                        <asp:ListItem Value="1">Home</asp:ListItem>
                        <asp:ListItem Value="2">Away</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td align="left">
                    <asp:Literal ID="Literal1" runat="server" Text="Send Invites:" />
                </td>
                <td align="left">
                    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                        <ContentTemplate>
                            <div style="overflow-y: scroll; width: 300px; height: 100px">
                                <asp:CheckBoxList ID="CheckBoxList1" runat="server" RepeatLayout="Flow" CausesValidation="false"
                                    RepeatColumns="3" RepeatDirection="Horizontal" CssClass="checkBoxList" AutoPostBack="true" OnSelectedIndexChanged="chklst1_SelectedIndexChanged">
                                </asp:CheckBoxList>
                            </div>
                            <input type="button" id="btnHiddenForUpdate" runat="server" style="display: none"
                                onserverclick="btnHiddenForUpdate_ServerClick" />
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
                <td align="left" style="width: 95px;">
                    <%--<asp:Button ID="btnSelectMembers" runat="server" Text="Select" OnClientClick="NewWindow()" />--%>
                    <a href="javascript:OpenChildWindow();">Select members</a>
                </td>
            </tr>
            <tr>
                <td colspan="3" align="left">
                    <%-- <input type="checkbox" id="checkbox1" runat="server"/>Recurrence--%>
                    <asp:CheckBox ID="CheckBox7" runat="server" onclick="CHeck()" Text="Recurrence" />
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    <div id="div_id" style="display: none; height: 50px;">
                        <asp:Panel ID="Panel2" runat="server" BorderColor="Black" BorderWidth="1px" Width="600px">
                            <table cellpadding="0" cellspacing="10" width="590px">
                                <tr>
                                    <td style="width: 100px" align="right">
                                        <table cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td style="vertical-align: top; width: 100px; height: 1px" align="left">
                                                    <asp:RadioButton ID="rbtnHourly" Checked="true" runat="server" GroupName="Recurrences"
                                                        Text="Hourly" />
                                                </td>
                                                <%-- <td style="vertical-align: top" ddlStarttime>
                                                    <asp:Literal ID="Literal2" runat="server" Text="Hourly" />
                                                </td>--%>
                                            </tr>
                                            <tr>
                                                <td style="vertical-align: top; width: 100px; height: 1px" align="left">
                                                    <asp:RadioButton ID="rbtnDaily" runat="server" GroupName="Recurrences" Text="Daily" />
                                                </td>
                                                <%--<td style="vertical-align: top" align="left">
                                                    <asp:Literal ID="Literal3" runat="server" Text="Daily" />
                                                </td>--%>
                                            </tr>
                                            <tr>
                                                <td style="vertical-align: top; width: 100px; height: 1px" align="left">
                                                    <asp:RadioButton ID="rbtnWeekly" runat="server" GroupName="Recurrences" Text="Weekly" />
                                                </td>
                                                <%-- <td style="vertical-align: top" align="left">
                                                    <asp:Literal ID="Literal4" runat="server" Text="Weekly" />
                                                </td>--%>
                                            </tr>
                                            <tr>
                                                <td style="vertical-align: top; width: 100px; height: 1px" align="left">
                                                    <asp:RadioButton ID="rbtnMonthly" runat="server" GroupName="Recurrences" Text="Monthly" />
                                                </td>
                                                <%-- <td style="vertical-align: top" align="left">
                                                    <asp:Literal ID="Literal5" runat="server" Text="Monthly" />
                                                </td>--%>
                                            </tr>
                                            <tr>
                                                <td style="vertical-align: top; width: 100px; height: 1px" align="left">
                                                    <asp:RadioButton ID="rbtnYearly" runat="server" GroupName="Recurrences" Text="Yearly" />
                                                </td>
                                                <%-- <td style="vertical-align: top" align="left">
                                                    <asp:Literal ID="Literal6" runat="server" Text="Yearly" />
                                                </td>--%>
                                            </tr>
                                        </table>
                                    </td>
                                    <td style="vertical-align: top" align="left" colspan="2">
                                        <div id="pnlHourly">
                                            <table style="margin-top: 10px;" width="100%">
                                                <tr>
                                                    <td align="left">
                                                        <asp:Literal ID="Literal7" runat="server" Text="Every" />
                                                        <asp:TextBox ID="updown" runat="server" ClientIDMode="Static" Text="1" Width="30px">
                                                        </asp:TextBox>
                                                        <asp:Literal ID="Literal8" runat="server" Text="hour(s)" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                        <div id="pnlDaily" style="display: none">
                                            <table style="margin-top: 10px;" width="100%">
                                                <tr>
                                                    <td align="left" style="vertical-align: top">
                                                        <asp:RadioButton ID="rbtnEveryday" runat="server" Checked="true" GroupName="pnlDaily" />
                                                        <asp:Literal ID="Literal" runat="server" Text="Every" />
                                                        <asp:TextBox ID="TextBox1" runat="server" ClientIDMode="Static" Text="1" Width="30px">
                                                        </asp:TextBox>
                                                        <asp:Literal ID="Literal9" runat="server" Text=" day(s)" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td align="left" style="vertical-align: top">
                                                        <asp:RadioButton ID="rbtnEveryweekday" runat="server" GroupName="pnlDaily" />
                                                        <asp:Literal ID="Literal10" runat="server" Text="Every weekday" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                        <div id="pnlWeekly" style="display: none">
                                            <table style="margin-top: 10px;" width="100%">
                                                <tr>
                                                    <td style="vertical-align: top" align="left">
                                                        <asp:Literal ID="Literal11" runat="server" Text="Recur every" />
                                                        <asp:TextBox ID="TextBox2" runat="server" ClientIDMode="Static" Text="1" Width="30px">
                                                        </asp:TextBox>
                                                        <asp:Literal ID="Literal12" runat="server" Text="week(s) on" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="vertical-align: top" align="left">
                                                        <table>
                                                            <tr>
                                                                <td style="vertical-align: top; width: 15px">
                                                                    <asp:CheckBox ID="chkSunday" runat="server" />
                                                                </td>
                                                                <td style="vertical-align: top">
                                                                    <asp:Label ID="label1" runat="server" Text="Sunday" />
                                                                </td>
                                                                <td style="vertical-align: top; width: 15px">
                                                                    <asp:CheckBox ID="chkMonday" runat="server" />
                                                                </td>
                                                                <td style="vertical-align: top">
                                                                    <asp:Literal ID="Literal13" runat="server" Text="Monday" />
                                                                </td>
                                                                <td style="vertical-align: top; width: 15px">
                                                                    <asp:CheckBox ID="chkTuesday" runat="server" />
                                                                </td>
                                                                <td style="vertical-align: top">
                                                                    <asp:Literal ID="Literal14" runat="server" Text="Tuesday" />
                                                                </td>
                                                                <td style="vertical-align: top; width: 15px">
                                                                    <asp:CheckBox ID="chkWednesday" runat="server" />
                                                                </td>
                                                                <td style="vertical-align: top">
                                                                    <asp:Literal ID="Literal15" runat="server" Text="Wednesday" />
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td style="vertical-align: top; width: 15px">
                                                                    <asp:CheckBox ID="chkThursday" runat="server" />
                                                                </td>
                                                                <td style="vertical-align: top">
                                                                    <asp:Literal ID="Literal16" runat="server" Text="Thursday" />
                                                                </td>
                                                                <td style="vertical-align: top; width: 15px">
                                                                    <asp:CheckBox ID="chkFriday" runat="server" />
                                                                </td>
                                                                <td style="vertical-align: top">
                                                                    <asp:Literal ID="Literal17" runat="server" Text="Friday" />
                                                                </td>
                                                                <td style="vertical-align: top; width: 15px">
                                                                    <asp:CheckBox ID="chkSaturday" runat="server" Checked="true" />
                                                                </td>
                                                                <td style="vertical-align: top">
                                                                    <asp:Literal ID="Literal18" runat="server" Text="Saturday" />
                                                                </td>
                                                                <td>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                        <div id="pnlMonthly" style="display: none">
                                            <table style="margin-top: 10px;" width="100%">
                                                <tr>
                                                    <td align="left">
                                                        <asp:RadioButton ID="RadioButton1" runat="server" Checked="true" GroupName="pblMonthly" />
                                                        <asp:Literal ID="Literal19" runat="server" Text="Day" />
                                                        <asp:TextBox ID="TextBox3" runat="server" ClientIDMode="Static" Text="1" Width="30px">
                                                        </asp:TextBox>
                                                        <asp:Literal ID="Literal20" runat="server" Text="of Every" />
                                                        <asp:TextBox ID="TextBox4" runat="server" ClientIDMode="Static" Text="1" Width="30px">
                                                        </asp:TextBox>
                                                        <asp:Literal ID="Literal21" runat="server" Text=" month (s)" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td align="left">
                                                        <asp:RadioButton ID="RadioButton2" runat="server" GroupName="pblMonthly" />
                                                        <asp:Literal ID="Literal22" runat="server" Text="The" />
                                                        <asp:DropDownList ID="ddlpnlMonthlynum" runat="server">
                                                            <asp:ListItem Value="1">first</asp:ListItem>
                                                            <asp:ListItem Value="2">second</asp:ListItem>
                                                            <asp:ListItem Value="3">third</asp:ListItem>
                                                            <asp:ListItem Value="4">fourth</asp:ListItem>
                                                            <asp:ListItem Value="5">last</asp:ListItem>
                                                        </asp:DropDownList>
                                                        <asp:DropDownList ID="ddlpnlMonthlyday" runat="server">
                                                            <asp:ListItem Value="1">day</asp:ListItem>
                                                            <asp:ListItem Value="2">weekday</asp:ListItem>
                                                            <asp:ListItem Value="3">weekend</asp:ListItem>
                                                            <asp:ListItem Value="4">Sunday</asp:ListItem>
                                                            <asp:ListItem Value="5">Monday</asp:ListItem>
                                                            <asp:ListItem Value="6">Tuesday</asp:ListItem>
                                                            <asp:ListItem Value="7">Wednesday</asp:ListItem>
                                                            <asp:ListItem Value="8">Thursday</asp:ListItem>
                                                            <asp:ListItem Value="9">Friday</asp:ListItem>
                                                            <asp:ListItem Value="10">Saturday</asp:ListItem>
                                                        </asp:DropDownList>
                                                        <asp:Literal ID="Literal23" runat="server" Text="of every" />
                                                        <asp:TextBox ID="TextBox5" runat="server" ClientIDMode="Static" Text="1" Width="30px">
                                                        </asp:TextBox>
                                                        <asp:Literal ID="Literal24" runat="server" Text="month(s)" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                        <div id="pnlYearly" style="display: none">
                                            <table style="margin-top: 10px;" width="100%">
                                                <tr>
                                                    <td align="left">
                                                        <asp:RadioButton ID="RadioButton3" runat="server" Checked="true" GroupName="pnlYearly" />
                                                        <%-- </td>
                                                    <td>--%>
                                                        <asp:DropDownList ID="ddlpnlYearlymonth" runat="server">
                                                            <asp:ListItem Value="1">January</asp:ListItem>
                                                            <asp:ListItem Value="2">February</asp:ListItem>
                                                            <asp:ListItem Value="3">March</asp:ListItem>
                                                            <asp:ListItem Value="4">April</asp:ListItem>
                                                            <asp:ListItem Value="5">May</asp:ListItem>
                                                            <asp:ListItem Value="6">June</asp:ListItem>
                                                            <asp:ListItem Value="7">July</asp:ListItem>
                                                            <asp:ListItem Value="8">Augest</asp:ListItem>
                                                            <asp:ListItem Value="9">September</asp:ListItem>
                                                            <asp:ListItem Value="10">October</asp:ListItem>
                                                            <asp:ListItem Value="11">November</asp:ListItem>
                                                            <asp:ListItem Value="12">December</asp:ListItem>
                                                        </asp:DropDownList>
                                                        <asp:TextBox ID="TextBox6" runat="server" ClientIDMode="Static" Text="1" Width="30px">
                                                        </asp:TextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td align="left">
                                                        <asp:RadioButton ID="RadioButton4" runat="server" GroupName="pnlYearly" />
                                                        <asp:Literal ID="Litthe" runat="server" Text="The" />
                                                        <asp:DropDownList ID="DropDownList1" runat="server">
                                                            <asp:ListItem Value="1">first</asp:ListItem>
                                                            <asp:ListItem Value="2">second</asp:ListItem>
                                                            <asp:ListItem Value="3">third</asp:ListItem>
                                                            <asp:ListItem Value="4">fourth</asp:ListItem>
                                                            <asp:ListItem Value="5">last</asp:ListItem>
                                                        </asp:DropDownList>
                                                        <asp:DropDownList ID="DropDownList2" runat="server">
                                                            <asp:ListItem Value="1">day</asp:ListItem>
                                                            <asp:ListItem Value="2">weekday</asp:ListItem>
                                                            <asp:ListItem Value="3">weekend</asp:ListItem>
                                                            <asp:ListItem Value="4">Sunday</asp:ListItem>
                                                            <asp:ListItem Value="5">Monday</asp:ListItem>
                                                            <asp:ListItem Value="6">Tuesday</asp:ListItem>
                                                            <asp:ListItem Value="7">Wednesday</asp:ListItem>
                                                            <asp:ListItem Value="8">Thursday</asp:ListItem>
                                                            <asp:ListItem Value="9">Friday</asp:ListItem>
                                                            <asp:ListItem Value="10">Saturday</asp:ListItem>
                                                        </asp:DropDownList>
                                                        of
                                                        <asp:DropDownList ID="DropDownList3" runat="server">
                                                            <asp:ListItem Value="1">January</asp:ListItem>
                                                            <asp:ListItem Value="2">February</asp:ListItem>
                                                            <asp:ListItem Value="3">March</asp:ListItem>
                                                            <asp:ListItem Value="4">April</asp:ListItem>
                                                            <asp:ListItem Value="5">May</asp:ListItem>
                                                            <asp:ListItem Value="6">June</asp:ListItem>
                                                            <asp:ListItem Value="7">July</asp:ListItem>
                                                            <asp:ListItem Value="8">Augest</asp:ListItem>
                                                            <asp:ListItem Value="9">September</asp:ListItem>
                                                            <asp:ListItem Value="10">October</asp:ListItem>
                                                            <asp:ListItem Value="11">November</asp:ListItem>
                                                            <asp:ListItem Value="12">December</asp:ListItem>
                                                        </asp:DropDownList>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="3">
                                        <hr />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 100px" align="left">
                                        <asp:RadioButton ID="rbtnEnddateno" Checked="true" runat="server" GroupName="Enddate"
                                            Text="No end date" />
                                    </td>
                                    <td align="left">
                                        <asp:RadioButton ID="rbtnEnddateafter" runat="server" GroupName="Enddate" Text="End after" />
                                        <asp:TextBox ID="TextBox7" runat="server" ClientIDMode="Static" Text="1" Width="30px" />
                                        <asp:Literal ID="Literal2" runat="server" Text="occurrences" />
                                    </td>
                                    <td style="width: 250px" align="left">
                                        <asp:RadioButton ID="rbtnEnddate" runat="server" GroupName="Enddate" Text="End by" />
                                        <asp:TextBox ID="TextBox8" runat="server" Width="70px"></asp:TextBox>
                                        <asp:Image ID="Image1" runat="server" Height="15" Width="15" />
                                        <asp:CalendarExtender ID="CalendarExtender2" runat="server" Enabled="True" TargetControlID="TextBox8"
                                            PopupButtonID="Image1">
                                        </asp:CalendarExtender>
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <div runat="server" id="jsonDiv" />
    <input type="hidden" id="hdClient" runat="server" />
    </form>
</body></html>

this is server side code

protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // GetEvents();
                Session["key"] = Login.ClubKey;
                // YourType obj = js.Deserialize<YourType>(json);
            }
        }
        protected void chklst1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Session["SelectMembers"] = null;
            DataTable DTsession = new DataTable();
            DTsession.Columns.Add("Member_Key");
            DTsession.Columns.Add("Member_Name");
            foreach (ListItem li in CheckBoxList1.Items)
            {
                if (li.Selected)
                {
                    DataRow Row = DTsession.NewRow();
                    Row["Member_Key"] = int.Parse(li.Value);
                    Row["Member_Name"] = li.Text;
                    DTsession.Rows.Add(Row);
                }
            }
            Session["SelectMembers"] = DTsession;
        }
        protected void chklst2_SelectedIndexChanged(object sender, EventArgs e)
        {
            Session["SelectMembers"] = null;
            DataTable DTsession = new DataTable();
            DTsession.Columns.Add("Member_Key");
            DTsession.Columns.Add("Member_Name");
            foreach (ListItem li in CheckBoxList2.Items)
            {
                if (li.Selected)
                {
                    DataRow Row = DTsession.NewRow();
                    Row["Member_Key"] = int.Parse(li.Value);
                    Row["Member_Name"] = li.Text;
                    DTsession.Rows.Add(Row);
                }
            }
            Session["SelectMembers"] = DTsession;
        }

        [System.Web.Services.WebMethod(EnableSession = true)]
        public static List<Event> GetEvents()
        {
            List<Event> events;
           
                BEvents obj = new BEvents();
                obj.ClubKey = (int)HttpContext.Current.Session["key"];
                DataTable DT = obj.View();
               
                events = new List<Event>();
                foreach (DataRow dr in DT.Rows)
                {
                    Event _Event = new Event();
                    _Event.EventID = int.Parse(dr["Event_Key"].ToString());
                    _Event.EventName = (string)dr["Event_Title"].ToString();
                    _Event.description = (string)dr["Event_Description"].ToString();
                    _Event.StartDate = dr["Event_StartDate"].ToString();
                    _Event.EndDate = dr["Event_EndDate"].ToString();
                    _Event.EventStarttime = dr["Event_StartTime"].ToString();
                    _Event.EventEndtime = dr["Event_EndTime"].ToString();
                    _Event.EventVenue = dr["Event_LocationKey"].ToString();
                    events.Add(_Event);
                }
            return events;
        }

       [System.Web.Services.WebMethod(EnableSession = true)]
        public static bool UpdateEvent(Event eventToAdd1)
        {
            BEvents obj = new BEvents();
            //List<Event> events;
            //if (HttpContext.Current.Session["events"] != null)
            //    events = (List<Event>)HttpContext.Current.Session["events"];
            //else
            //    events = new List<Event>();
            //if (events.Contains(eventToAdd1))
            //{
            //    //Update DB
            //    Event _MyEvent = events.Find(
            //    delegate(Event bk)
            //    {
            //        return bk.EventID == eventToAdd1.EventID;
            //    });
            //    if (_MyEvent is object)
            //    {
            //        _MyEvent.StartDate = eventToAdd1.StartDate;
            //        _MyEvent.EndDate = eventToAdd1.EndDate;
            //    }
            //}
            if (eventToAdd1 != null)
            {
                obj.EventKey = eventToAdd1.id;
                obj.ClubKey = (int)HttpContext.Current.Session["key"];
                obj.EventName = eventToAdd1.title;
                obj.Description = eventToAdd1.description;
                DateTime dstart = Convert.ToDateTime(eventToAdd1.start);
                obj.EventStartDate = dstart.ToString("dd-MMM-yyyy");
                DateTime dtend = Convert.ToDateTime(eventToAdd1.end);
                obj.EventEndDate = dtend.ToString("dd-MMM-yyyy");
                if (eventToAdd1.EventStarttime != null)
                {
                    DateTime t = DateTime.ParseExact(eventToAdd1.EventStarttime, "H:mm tt", CultureInfo.InvariantCulture);
                    //if you really need a TimeSpan this will get the time elapsed since midnight:
                    TimeSpan ts = t.TimeOfDay;
                    obj.EventStartTime = ts;
                }
                else
                {
                    obj.EventStartTime = "";
                }
                if (eventToAdd1.EventEndtime != null)
                {
                    DateTime te = DateTime.ParseExact(eventToAdd1.EventEndtime, "H:mm tt", CultureInfo.InvariantCulture);
                    //if you really need a TimeSpan this will get the time elapsed since midnight:
                    TimeSpan tend = te.TimeOfDay;
                    obj.EventEndTime = tend;
                }
                else
                {
                    obj.EventEndTime = "";
                }
                obj.isRecursive = Convert.ToBoolean(1);
                string BYDAY = "";

                if (eventToAdd1.BYDAY2 != null)
                {
                    BYDAY += "," + eventToAdd1.BYDAY2.ToString();
                }
                if (eventToAdd1.BYDAY3 != null)
                {
                    BYDAY += "," + eventToAdd1.BYDAY3.ToString();
                }
                if (eventToAdd1.BYDAY4 != null)
                {
                    BYDAY += "," + eventToAdd1.BYDAY4.ToString();
                }
                if (eventToAdd1.BYDAY5 != null)
                {
                    BYDAY += "," + eventToAdd1.BYDAY5.ToString();
                }
                if (eventToAdd1.BYDAY6 != null)
                {
                    BYDAY += "," + eventToAdd1.BYDAY6.ToString();
                }
                if (eventToAdd1.BYDAY7 != null)
                {
                    BYDAY += "," + eventToAdd1.BYDAY7.ToString();
                }
                if (eventToAdd1.BYDAY8 != null)
                {
                    BYDAY += "," + eventToAdd1.BYDAY8.ToString();
                }
                obj.Event_FREQ = Convert.ToString(eventToAdd1.FREQ == "" ? "" : eventToAdd1.FREQ);
                obj.Event_INTERVAL = int.Parse(eventToAdd1.INTERVAL == "" ? "0" : eventToAdd1.INTERVAL);
                obj.Event_BYSETPOS = int.Parse(eventToAdd1.BYSETPOS == "" ? "0" : eventToAdd1.BYSETPOS);
                obj.Event_BYDAY = Convert.ToString(BYDAY == "" ? "" : BYDAY);
                obj.Event_BYMONTH = int.Parse(eventToAdd1.BYMONTH == "" ? "0" : eventToAdd1.BYMONTH);
                obj.Event_BYMONTHDAY = int.Parse(eventToAdd1.BYMONTHDAY == "" ? "0" : eventToAdd1.BYMONTHDAY);
                obj.Event_UNTIL = Convert.ToString(eventToAdd1.UNTIL == null ? "" : eventToAdd1.UNTIL);
                obj.Event_COUNT = int.Parse(eventToAdd1.COUNT == "" ? "0" : eventToAdd1.COUNT);
                obj.SaveEvent();
                DataTable dt = (DataTable)HttpContext.Current.Session["SelectMembers"];
                if (dt.Rows.Count != null && dt != null)
                {
                    foreach (DataRow ROW in dt.Rows)
                    {
                        obj.MembersList.Add(Convert.ToInt32(ROW["Member_Key"].ToString()));
                    }
                }
                obj.SaveMembers();
                HttpContext.Current.Session["SelectMembers"] = null;
            }
            return true;
        }

        [System.Web.Services.WebMethod]
        public static bool deleteEvent(string eventdata1)
        {
            BEvents obj = new BEvents();
            obj.EventKey = int.Parse(eventdata1);
            obj.DeleteEvent();
            GetEvents();
            return true;
        }

        [System.Web.Services.WebMethod(EnableSession = true)]
        public static bool addEvent(Event eventToAdd1)
        {
            BEvents obj = new BEvents();
            //List<Event> events;
            //if (HttpContext.Current.Session["events"] != null)
            //    events = (List<Event>)HttpContext.Current.Session["events"];
            //else
            //    events = new List<Event>();
            //if (events.Contains(eventToAdd1))
            //{
            //    //Update DB
            //    Event _MyEvent = events.Find(
            //    delegate(Event bk)
            //    {
            //        return bk.id == eventToAdd1.id;
            //    });

            //    if (_MyEvent is object)
            //    {
            //        _MyEvent.start = eventToAdd1.start;
            //        _MyEvent.end = eventToAdd1.end;
            //    }
            //}
            if (eventToAdd1 != null)
            {
                obj.ClubKey = (int)HttpContext.Current.Session["key"];
                obj.EventName = eventToAdd1.title;
                obj.Description = eventToAdd1.description;
                DateTime dstart = Convert.ToDateTime(eventToAdd1.start);
                obj.EventStartDate = dstart.ToString("dd-MMM-yyyy");
                DateTime dtend = Convert.ToDateTime(eventToAdd1.end);
                obj.EventEndDate = dtend.ToString("dd-MMM-yyyy");
                if (eventToAdd1.EventStarttime != null)
                {
                    DateTime t = DateTime.ParseExact(eventToAdd1.EventStarttime, "H:mm tt", CultureInfo.InvariantCulture);
                    //if you really need a TimeSpan this will get the time elapsed since midnight:
                    TimeSpan ts = t.TimeOfDay;
                    obj.EventStartTime = ts;
                }
                else
                {
                    obj.EventStartTime = "";
                }
                if (eventToAdd1.EventEndtime != null)
                {
                    DateTime te = DateTime.ParseExact(eventToAdd1.EventEndtime, "H:mm tt", CultureInfo.InvariantCulture);
                    //if you really need a TimeSpan this will get the time elapsed since midnight:
                    TimeSpan tend = te.TimeOfDay;
                    obj.EventEndTime = tend;
                }
                else
                {
                    obj.EventEndTime = "";
                }
                obj.isRecursive = Convert.ToBoolean(1);
                string BYDAY = "";

                if (eventToAdd1.BYDAY2 != null)
                {
                    BYDAY += "," + eventToAdd1.BYDAY2.ToString();
                }
                if (eventToAdd1.BYDAY3 != null)
                {
                    BYDAY += "," + eventToAdd1.BYDAY3.ToString();
                }
                if (eventToAdd1.BYDAY4 != null)
                {
                    BYDAY += "," + eventToAdd1.BYDAY4.ToString();
                }
                if (eventToAdd1.BYDAY5 != null)
                {
                    BYDAY += "," + eventToAdd1.BYDAY5.ToString();
                }
                if (eventToAdd1.BYDAY6 != null)
                {
                    BYDAY += "," + eventToAdd1.BYDAY6.ToString();
                }
                if (eventToAdd1.BYDAY7 != null)
                {
                    BYDAY += "," + eventToAdd1.BYDAY7.ToString();
                }
                if (eventToAdd1.BYDAY8 != null)
                {
                    BYDAY += "," + eventToAdd1.BYDAY8.ToString();
                }
                obj.Event_FREQ = Convert.ToString(eventToAdd1.FREQ == "" ? "" : eventToAdd1.FREQ);
                obj.Event_INTERVAL = int.Parse(eventToAdd1.INTERVAL == "" ? "0" : eventToAdd1.INTERVAL);
                obj.Event_BYSETPOS = int.Parse(eventToAdd1.BYSETPOS == "" ? "0" : eventToAdd1.BYSETPOS);
                obj.Event_BYDAY = Convert.ToString(BYDAY == "" ? "" : BYDAY);
                obj.Event_BYMONTH = int.Parse(eventToAdd1.BYMONTH == "" ? "0" : eventToAdd1.BYMONTH);
                obj.Event_BYMONTHDAY = int.Parse(eventToAdd1.BYMONTHDAY == "" ? "0" : eventToAdd1.BYMONTHDAY);
                obj.Event_UNTIL = Convert.ToString(eventToAdd1.UNTIL == null ? "" : eventToAdd1.UNTIL);
                obj.Event_COUNT = int.Parse(eventToAdd1.COUNT == "" ? "0" : eventToAdd1.COUNT);
                obj.SaveEvent();
                if (HttpContext.Current.Session["SelectMembers"] != null)
                {
                    DataTable dt = (DataTable)HttpContext.Current.Session["SelectMembers"];
                    if (dt.Rows.Count != null && dt != null)
                    {
                        foreach (DataRow ROW in dt.Rows)
                        {
                            obj.MembersList.Add(Convert.ToInt32(ROW["Member_Key"].ToString()));
                        }
                    }
                    obj.SaveMembers();
                }
              
                HttpContext.Current.Session["SelectMembers"] = null;
            }
            //HttpContext.Current.Session["events"] = events;
            return true;

        }
     
        protected void btnHiddenForUpdate_ServerClick(object sender, EventArgs e)
        {
            if (Session["SelectMembers"] != null)
            {
                DataTable DT = (DataTable)Session["SelectMembers"];
                CheckBoxList1.DataSource = DT;
                CheckBoxList1.DataTextField = "Member_Name";
                CheckBoxList1.DataValueField = "Member_Key";
                CheckBoxList1.DataBind();
                foreach (ListItem li in CheckBoxList1.Items)
                {
                    li.Selected = true;
                }
              
            }
        }
        protected void btnHiddenForUpdate2_ServerClick(object sender, EventArgs e)
        {
            if (Session["SelectMembers"] != null)
            {
                DataTable DT = (DataTable)Session["SelectMembers"];
                CheckBoxList2.DataSource = DT;
                CheckBoxList2.DataTextField = "Member_Name";
                CheckBoxList2.DataValueField = "Member_Key";
                CheckBoxList2.DataBind();
                foreach (ListItem li in CheckBoxList2.Items)
                {
                    li.Selected = true;
                }

            }
        }

Comments

Popular posts from this blog

what is Event Cache table in sharepoint

CAML Query syntax and options in SharePoint

Change anchor link url in sharepoint calender