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

RadWindow and RadPanel

3 Answers 101 Views
Window
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 2
Shawn asked on 11 Sep 2008, 02:55 PM
I have a form that is calling a RadWindow to update user information.  The user double clicks a username from a page it then brings up a RadWindow with the user information in a form that they can change.  They then click a save settings button that updates the information and goes back to the parent page using 

InjectScriptLabel.Text =

"<script>RefreshParentPage()</" + "script>"

This works perfectly.  

My problem arises when I place the form into a RadPanel to Ajaxify it the InjectScript does not work, so when the save Settings button is clicked the windows remains open. I need it to close.

Any ideas on how this can be fixed?
 

3 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 12 Sep 2008, 12:09 PM
Hello Shawn,

When using Ajax in such scenario, you must make sure that the label is ajaxified as well and the type of the script is specified (e.g type='text/javascript'). In addition, I suggest to use the scripts collection of the Ajax panel to output the JavaScript.



Greetings,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Shawn
Top achievements
Rank 2
answered on 12 Sep 2008, 03:41 PM
I have changed the inject to include the text/javascript call.  The problem is....the RadWindow is not closing. I am calling the Inject on the Save Settings button onClick. 

    Protected Sub btnSaveSettings_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSaveSettings.Click  
 
        Finally  
 
            Groups = Nothing 
 
            InjectScriptLabel.Text = "<script type='text/javascript'>RefreshParentPage()</" + "script>"  
 
        End Try  
 
End Sub 

The java is....

<script language="javascript" type="text/javascript">  
 
function RefreshParentPage()  
{     
      GetRadWindow().BrowserWindow.location.reload();  
}  
 
 
function GetRadWindow()  
{  
    var oWindow = null;  
    if (window.radWindow) oWindow = window.radWindow;//Will work in Moz in all cases, including clasic dialog  
    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz az well)  
    return oWindow;  
}    
 
</script> 

This is the rest.....

<body> 
    <form id="form1" runat="server">  
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
        </telerik:RadScriptManager> 
        <asp:UpdatePanel ID="pupdate" runat="server" UpdateMode="Conditional">  
        <Triggers> 
        <asp:AsyncPostBackTrigger ControlID ="chkIsROLContact" /> 
        </Triggers> 
        <ContentTemplate> 
    <div> 
        <asp:Label ID="lblHeader" runat="server" /> 
        <br /> 
        <br /> 
        <asp:Button ID="btnSaveSettings" runat="server" Text="Save Settings" /> 
        <asp:Label ID="InjectScriptLabel" runat="server"></asp:Label> 
        <br /> 
        <br /> 
        <telerik:RadTabStrip ID="rtsEditUsers" runat="server" MultiPageID="rmpEditUsers" 
            Skin="Vista" SelectedIndex="0" ReorderTabsOnSelect="true" Width="500" CausesValidation="false">  
            <Tabs> 
                <telerik:RadTab Text="User Information">  
                </telerik:RadTab> 
                <telerik:RadTab Text="General Access">  
                </telerik:RadTab> 
                <telerik:RadTab Text="Part D Access">  
                </telerik:RadTab> 
                <telerik:RadTab Text="Today's Option Access">  
                </telerik:RadTab> 
            </Tabs> 
        </telerik:RadTabStrip> 
        <telerik:RadMultiPage ID="rmpEditUsers" runat="server" SelectedIndex="0" CssClass="pageView">  
            <telerik:RadPageView ID="rpvUserInfo" runat="server">  
                <table border="0" cellpadding="3" cellspacing="1"   
                    style="width: 628px; margin-right: 131px">  
                    <tr> 
                        <td class="style1">  
                        </td> 
                        <td class="style2">  
                            <asp:CheckBox ID="chkIsROLContact" runat="server" Text="TO - ROL Contact" AutoPostBack="True" /> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td align="left" class="style1">  
                            Username:  
                        </td> 
                        <td class="style2">  
                            <asp:TextBox ID="tbUsername" runat="server" Width="300" SkinID="RequiredField" /> 
                        </td> 
                        <td><asp:RequiredFieldValidator ID="UsernameRequiredValidator" runat="server" ControlToValidate="tbUsername" 
            ForeColor="red" Display="Dynamic" ErrorMessage="Username is required." /></td>  
                    </tr> 
                    <tr> 
                        <td style="text-align: left;" class="style1">  
                            First Name:  
                        </td> 
                        <td class="style2">  
                            <asp:TextBox ID="tbFirstName" runat="server" Width="300" SkinID="RequiredField" /> 
                        </td> 
                        <td><asp:RequiredFieldValidator ID="rfvFirstName" runat="server" ControlToValidate="tbFirstName" 
            ForeColor="red" Display="Dynamic" SetFocusOnError="true" ErrorMessage="First name is required." /></td>  
                    </tr> 
                    <tr> 
                        <td style="text-align: left;" class="style1">  
                            Middle Name:  
                        </td> 
                        <td style="text-align: left;" class="style2">  
                            <asp:TextBox ID="tbMiddleName" runat="server" Width="300" /> 
                        </td> 
                        <td></td>  
                    </tr> 
                    <tr> 
                        <td style="text-align: left;" class="style1">  
                            Last Name:  
                        </td> 
                        <td class="style2">  
                            <asp:TextBox ID="tbLastName" runat="server" Width="300" SkinID="RequiredField" /> 
                        </td> 
                        <td><asp:RequiredFieldValidator ID="rfvLastName" runat="server" ControlToValidate="tbLastName" 
            ForeColor="red" Display="Dynamic" SetFocusOnError="true" ErrorMessage="Last name is required." /></td>  
                    </tr> 
                    <tr> 
                        <td style="text-align: left;" class="style1">  
                            Title:  
                        </td> 
                        <td class="style2">  
                            <asp:TextBox ID="tbTitle" runat="server" Width="300" SkinID="RequiredField" /> 
                        </td> 
                        <td><asp:RequiredFieldValidator ID="rfvTitle" runat="server" ControlToValidate="tbTitle" 
            ForeColor="red" Display="Dynamic" SetFocusOnError="true" Enabled="false" ErrorMessage="Title is required." /></td>  
                    </tr> 
                    <tr> 
                        <td style="text-align: left;" class="style1">  
                            Phone:  
                        </td> 
                        <td class="style2">  
                            <asp:TextBox ID="tbPhone" runat="server" Width="300" SkinID="RequiredField" /> 
                        </td> 
                        <td></td>  
                    </tr> 
                    <tr> 
                        <td style="text-align: left;" class="style1">  
                            Fax:  
                        </td> 
                        <td class="style2">  
                            <asp:TextBox ID="tbFax" runat="server" Width="300" SkinID="RequiredField" /> 
                        </td> 
                        <td></td>  
                    </tr> 
                    <tr> 
                        <td style="text-align: left;" class="style1">  
                            Email Address:  
                        </td> 
                        <td class="style2">  
                            <asp:TextBox ID="tbEmail" runat="server" Width="300" SkinID="RequiredField" /> 
                        </td> 
                        <td><asp:RequiredFieldValidator ID="EmailRequiredValidator" runat="server" ControlToValidate="tbEmail" 
            ForeColor="red" Display="Dynamic" SetFocusOnError="true" ErrorMessage="Email address is required." /></td>  
                    </tr> 
                    <tr> 
                        <td style="text-align: left;" class="style1">  
                            Department  
                        </td> 
                        <td class="style2">  
                            <telerik:RadComboBox ID="rcbDepartment" runat="server" Skin="Vista" Width="300">  
                            </telerik:RadComboBox> 
                        </td> 
                        <td><asp:RequiredFieldValidator ID="rfvDepartment" runat="server" ControlToValidate="rcbDepartment" 
            ForeColor="red" Display="Dynamic" SetFocusOnError="true" Enabled="false" ErrorMessage="Department must be chosen from the drop-down list." /></td>  
                    </tr> 
                    <tr> 
                        <td style="text-align: left;" class="style1">  
                            Location  
                        </td> 
                        <td class="style2">  
                            <telerik:RadComboBox ID="rcbLocation" runat="server" Skin="Vista" Width="300">  
                            </telerik:RadComboBox> 
                        </td> 
                        <td><asp:RequiredFieldValidator ID="rfvLocation" runat="server" ControlToValidate="rcbLocation" 
            ForeColor="red" Display="Dynamic" SetFocusOnError="true" Enabled="false" ErrorMessage="Location must be chosen from the drop-down list." /></td>  
                    </tr> 
                    <tr> 
                        <td class="style1">  
                            Security Class  
                        </td> 
                        <td class="style2">  
                            <telerik:RadComboBox ID="rcbSecuirtyClass" runat="server" Skin="Vista" Width="300">  
                            </telerik:RadComboBox> 
                        </td> 
                        <td></td>  
                    </tr> 
                </table> 
            </telerik:RadPageView> 
            <telerik:RadPageView ID="rpvGeneral" runat="server">  
                <table style="text-align: left" cellspacing="5" cellpadding="1">  
                    <tr> 
                        <td> 
                            <asp:CheckBox ID="cbGeneralRoleAccess" runat="server" /> 
                            <asp:Literal ID="lGeneralRoleAccess" runat="server" /> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td> 
                            <asp:CheckBoxList ID="cblGeneralRoleAccess" runat="server" /> 
                        </td> 
                    </tr> 
                </table> 
            </telerik:RadPageView> 
            <telerik:RadPageView ID="rpvPartD" runat="server">  
                <table style="text-align: left;" cellspacing="5" cellpadding="1">  
                    <tr> 
                        <td> 
                            Part D Role Access  
                        </td> 
                        <td colspan="6" align="center">  
                            Part D Group Access  
                        </td> 
                    </tr> 
                    <tr> 
                        <td> 
                        </td> 
                        <td> 
                            TRR  
                        </td> 
                    </tr> 
                    <tr> 
                        <td> 
                            <asp:CheckBox ID="cbPartDGeneralRoleAccess" runat="server" Visible="false" /> 
                            <asp:Literal ID="lPartDGeneralGroupAccess" runat="server" Visible="false" /> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td style="vertical-align: top;">  
                            <asp:CheckBoxList ID="cblPartDGeneralRoleAccess" runat="server" /> 
                        </td> 
                        <td style="vertical-align: top;">  
                            <asp:CheckBoxList ID="cblPartDTRRGroupAccess" runat="server" /> 
                        </td> 
                    </tr> 
                </table> 
            </telerik:RadPageView> 
            <telerik:RadPageView ID="rpvTO" runat="server">  
                <table style="text-align: left;" border="1" cellspacing="5" cellpadding="1">  
                    <tr> 
                        <td> 
                            Today's Options Role Access  
                        </td> 
                        <td colspan="6" align="center">  
                            Today's Options Group Access  
                        </td> 
                    </tr> 
                    <tr> 
                        <td> 
                        </td> 
                        <td> 
                            TRR  
                        </td> 
                    </tr> 
                    <tr> 
                        <td> 
                            <asp:CheckBox ID="cbTOGeneralRoleAccess" runat="server" Visible="false" /> 
                            <asp:Literal ID="lTOGeneralRoleAccess" runat="server" Visible="false" /> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td style="vertical-align: top;">  
                            <asp:CheckBoxList ID="cblTOGeneralRoleAccess" runat="server" /> 
                        </td> 
                        <td style="vertical-align: top;">  
                            <asp:CheckBoxList ID="cblTOTRRGroupAccess" runat="server" /> 
                        </td> 
                    </tr> 
                </table> 
            </telerik:RadPageView> 
        </telerik:RadMultiPage> 
    </div> 
        </ContentTemplate> 
        </asp:UpdatePanel> 
    </form> 
</body> 

 

0
Georgi Tunev
Telerik team
answered on 16 Sep 2008, 02:59 PM
Hello Shawn,

Make sure that the RefreshParentPage() function is called - just put a simple alert in it. If you still experience problems, please open a support ticket and send me a sample project where I can check your exact setup - I will get back to you with an appropriate solution right away.



Sincerely yours,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Window
Asked by
Shawn
Top achievements
Rank 2
Answers by
Georgi Tunev
Telerik team
Shawn
Top achievements
Rank 2
Share this question
or