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

Show RadWindow based on RadDropDownList Selected Item

1 Answer 36 Views
Window
This is a migrated thread and some comments may be shown as answers.
Saira
Top achievements
Rank 1
Saira asked on 27 Feb 2013, 06:25 PM
Hi,

I have the following requirement. There is a RadDropDownList containing three items and a RadButton on my submitDocs page. Based on the RadDropDownList selected item, I want to display the RadWindow contents on a RadButton click. Suppose the selected item is Item1, then on button click the Radwindow must display contents from www.samplesite.com/samplepage.aspx URL. Similarly for another item, display content from another URL. I prefer client side code to accomplish the above.

Thank You,
Saira.

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 28 Feb 2013, 05:32 AM
Hi Saira,

Please have a look into the following code to accomplish your requirement.

ASPX:
<telerik:RadWindow ID="RadWindow1" runat="server">
</telerik:RadWindow>
<telerik:RadDropDownList ID="RadDropDownList1" runat="server">
    <Items>
        <telerik:DropDownListItem Text="1" />
        <telerik:DropDownListItem Text="2" />
    </Items>
</telerik:RadDropDownList>
<telerik:RadButton ID="RadButton1" runat="server" Text="Show" OnClientClicked="OnClientClicked"
    AutoPostBack="false">
</telerik:RadButton>

JavaScript:
<script type="text/javascript">
    function OnClientClicked(sender, args) {
        var window = $find("<%= RadWindow1.ClientID %>");
        var dropdown = $find("<%= RadDropDownList1.ClientID %>");
        var selectedItem = dropdown.get_selectedItem();
        if (selectedItem._text == "1") {
            window.show();
            window.setSize(400, 400);
            window.setUrl("http://www.yoururl.com");
        }
        else if (selectedItem._text == "2") {
            window.show();
            window.setSize(400, 400);
            window.setUrl("http://www.yoururl.com");
        }
    }
</script>

Thanks,
Princy.
Tags
Window
Asked by
Saira
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or