This is a migrated thread and some comments may be shown as answers.

Setting SelectedDate from RadWindow Popup

2 Answers 42 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Kelly
Top achievements
Rank 1
Kelly asked on 13 Aug 2012, 01:17 AM
Hello all

Any help appreciated with the issue I'm having.  
I have a basic ASP.NET page where I have a RadScheduler.  
From the same page, I am popping up a RadWindow to save an item to the database.  

From the RadWindow server side code I am closing the RadWindow and saving items to my database and setting the "SelectedDate" of the RadScheduler from a RadDateTimePicker on the popup window.  Unfortunately, the RadScheduler doesn't change the month.

Any help or suggestions would be appreciated.  Thank you.

Source
<telerik:RadScriptBlock runat="server" ID="scbEdit">
    <script type="text/javascript">
        var oWnd = null;
 
        function btnCancel_Click(button, args) {
            oWnd.Close();
        }
         
        function winAppt_ClientActivate(sender){
            oWnd = sender;
        }
 
        function CloseDialog() {
            oWnd.Close();
        }
    </script>
</telerik:RadScriptBlock>
<div style="border-top: 1px solid #4CA5FF; border-bottom: 1px solid #4CA5FF; background-color: #D6F4FF; width: 100%;">
    <span style="font-size: 2pt;">
        <br />
         </span>
    <asp:Label ID="lblCompanyName" runat="server" CssClass="orangelargebbold" />
    <span style="font-size: 2pt;">
        <br />
         </span>
</div>
<div style="margin: 5px 3px 3px 0px; float: left; height: 1000px;">
    <tel:RadButton ID="btnNew" runat="server" Text="New Appointment" Skin="Web20" onclick="btnNew_Click" />
    <br /><br />
    <tel:RadWindow ID="winAppt" runat="server" EnableShadow="true" Title="New Appointment"
            Width="830px" Height="500px" Behaviors="Move, Close" VisibleStatusbar="false"
            Modal="true" Skin="Telerik" OnClientActivate="winAppt_ClientActivate">
        <ContentTemplate>
            <tel:RadAjaxPanel ID="pnlAppt" runat="server">
                <table style="width: 780px; padding: 5px; margin: 5px;">
                    <tr>
                        <td valign="middle"><span class="blackmedbold">Category</span></td>
                        <td><tel:RadComboBox ID="cmbCategory" runat="server" DataValueField="CatID"
                                DataTextField="Description" AutoPostBack="true"
                                OnSelectedIndexChanged="cmbCategory_SelectedIndexChanged" /></td>
                    </tr>
                    <tr>
                        <td><span class="blackmedbold">Service</span></td>
                        <td>
                            <tel:RadComboBox ID="cmbService" runat="server" Height="200px" Width="200px"
                                DropDownWidth="298px" HighlightTemplatedItems="true" EnableLoadOnDemand="true"
                                EmptyMessage="Select a service..." DataValueField="Serv_Value"
                                DataTextField="Description"
                                onselectedindexchanged="cmbService_SelectedIndexChanged" AutoPostBack="true">
                                <HeaderTemplate>
                                    <table style="width: 300px; color:#0026FF;" cellspacing="0" cellpadding="0" border="0">
                                        <tr>
                                            <td style="width: 100px;">Description</td>
                                            <td style="width: 100px;">Duration</td>
                                            <td style="width: 100px;">Price</td>
                                        </tr>
                                    </table>
                                </HeaderTemplate
                                <ItemTemplate>
                                    <table style="width: 300px; color: Black; font-size: 8pt; font-weight: normal;" cellspacing="0" cellpadding="0" border="0">
                                        <tr>
                                            <td style="width: 100px;"><%# DataBinder.Eval(Container.DataItem, "Description") %></td>
                                            <td style="width: 100px;"><%# DataBinder.Eval(Container.DataItem, "Duration")%></td>
                                            <td style="width: 100px;"><%# DataBinder.Eval(Container.DataItem, "Unit_Price")%></td>
                                        </tr>
                                    </table>                                                       
                                </ItemTemplate>
                            </tel:RadComboBox>                                                                                   
                        </td>
                    </tr>
                    <tr>
                        <td><span class="blackmedbold">Appointment Date</span></td>
                        <td><tel:RadDateTimePicker ID="dtpStartsOn" runat="server" /></td>
                    </tr>
                    <tr>
                        <td><span class="blackmedbold">Duration</span></td>
                        <td><tel:RadTextBox ID="txtDuration" runat="server" /></td>
                    </tr>
                    <tr>
                        <td><span class="blackmedbold">Number of Guests</span></td>
                        <td>          
                            <tel:RadComboBox ID="cmbGuests" runat="server" AutoPostBack="true" onselectedindexchanged="cmbGuests_SelectedIndexChanged">
                                <Items>
                                    <tel:RadComboBoxItem Value="1" Text="1" />
                                    <tel:RadComboBoxItem Value="2" Text="2" />
                                    <tel:RadComboBoxItem Value="3" Text="3" />
                                    <tel:RadComboBoxItem Value="4" Text="4" />
                                </Items>
                            </tel:RadComboBox>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <br />
                            <asp:PlaceHolder ID="pnlGuests" runat="server">
                                <spc:Guest ID="spcGuest1" runat="server" />
                                <spc:Guest ID="spcGuest2" runat="server" Visible="false" />
                                <spc:Guest ID="spcGuest3" runat="server" Visible="false" />
                                <spc:Guest ID="spcGuest4" runat="server" Visible="false" />
                            </asp:PlaceHolder>
                            <br />
                        </td>
                    </tr>
                    <tr>
                        <td><span class="blackmedbold">Notes</span></td>
                        <td><tel:RadTextBox ID="txtDescription" runat="server" TextMode="MultiLine" /></td>
                    </tr>
                    <tr>
                        <td><span class="blackmedbold">Reminder</span></td>
                        <td>
                            <tel:RadComboBox ID="cmbReminder" runat="server" EmptyMessage="Select Reminder">
                                <Items>
                                    <tel:RadComboBoxItem Value="1" Text="1 Day" />
                                    <tel:RadComboBoxItem Value="2" Text="2 Day" />
                                    <tel:RadComboBoxItem Value="3" Text="3 Day" />
                                    <tel:RadComboBoxItem Value="4" Text="4 Day" />
                                    <tel:RadComboBoxItem Value="5" Text="5 Day" />
                                    <tel:RadComboBoxItem Value="6" Text="6 Day" />
                                    <tel:RadComboBoxItem Value="7" Text="1 Week" />
                                    <tel:RadComboBoxItem Value="14" Text="2 Weeks" />
                                </Items>
                            </tel:RadComboBox>                   
                        </td>
                    </tr>
                </table>       
                <div style="text-align: right; padding: 5px; clear: both">               
                    <tel:RadButton ID="btnSubmit" runat="server" Text="Submit" Skin="Web20" OnClick="btnSubmit_Click" ></tel:RadButton>
                    <tel:RadButton ID="btnCancel" runat="server" Text="Cancel" Skin="Web20" OnClientClicked="btnCancel_Click"></tel:RadButton>
                </div>                           
            </tel:RadAjaxPanel>                     
        </ContentTemplate>
    </tel:RadWindow>        
    <tel:RadScheduler ID="schAppointments" runat="server" Width="1000px" Height="100%"
        SelectedView="MonthView" ShowFooter="false" DayStartTime="08:00:00"
        DayEndTime="21:00:00" WeekView-DayStartTime="08:00:00" WeekView-DayEndTime="21:00:00"
        FirstDayOfWeek="Monday" LastDayOfWeek="Sunday" EnableDescriptionField="true"
        AppointmentStyleMode="Default" DataKeyField="ApptID" DataSubjectField="Subject"
        DataStartField="Starts_On" DataEndField="Ends_On" DataDescriptionField="Description"
        AdvancedForm-Modal="true" StartInsertingInAdvancedForm="false" StartEditingInAdvancedForm="false"
        Reminders-Enabled="true" OnFormCreating="schAppointments_FormCreating" OverflowBehavior="Expand"
        >
         
        <AdvancedForm Modal="true" />
        <Reminders Enabled="true" />
        <TimeSlotContextMenuSettings EnableDefault="true" />
        <AppointmentContextMenuSettings EnableDefault="true" />           
    </tel:RadScheduler>
</div>
<div style="float: right; padding: 5px 3px;">
    <spc:VNav ID="spcNav" runat="server" />
</div>


Code Behind:
if (Appt.Save(Appointment.Xerialize()))
{
    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Close", "CloseDialog();", true);                   
    dSet = Appt.ByMonth(Convert.ToInt64(Session["locid"].ToString()), dtpStartsOn.SelectedDate.Value.Month);
    schAppointments.DataSource = dSet;
    schAppointments.DataBind();
    schAppointments.SelectedDate = dtpStartsOn.SelectedDate.Value;
}

2 Answers, 1 is accepted

Sort by
0
Cat Cheshire
Top achievements
Rank 1
answered on 14 Aug 2012, 10:38 AM
0
Peter
Telerik team
answered on 14 Aug 2012, 10:38 AM
Hello Kelly,

Attached is a sample on how to edit or insert appointments with RadWindow. You can also consider the demo with RadDock on the same functionality.

All the best,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Scheduler
Asked by
Kelly
Top achievements
Rank 1
Answers by
Cat Cheshire
Top achievements
Rank 1
Peter
Telerik team
Share this question
or