Show RadWindow based on RadDropDownList Selected Item

2 posts, 1 answers
  1. Saira
    Saira avatar
    24 posts
    Member since:
    Feb 2013

    Posted 27 Feb 2013 Link to this post

    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.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 27 Feb 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top