OnClose of Radwindow need to perform server side code

7 posts, 0 answers
  1. Albert
    Albert avatar
    6 posts
    Member since:
    Jan 2011

    Posted 01 Mar 2011 Link to this post

    Hi,

    Is there a way to perform a server side code, say bind a radtreeview after closing the radwindow or is there a way to bind a radtreeview to a linqdatasource control using javascript?

    Thanks!
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 01 Mar 2011 Link to this post

    Hello Albert,

    You can attach OnClientClose event to the window and make an ajaxRequest like given below and from there you can call the desired function.

    ClentSide:
    function OnClientClose ()
    {
      var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
            ajaxManager.ajaxRequest();
    }

    C#:
    protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
       {
           //your code here
       }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Spiros
    Spiros avatar
    15 posts
    Member since:
    May 2010

    Posted 19 May 2014 Link to this post

    Hi All .
    I have a similar problem. I am actually new to Telerik controls.
    I have a server side RadWindow which is called from server
    side. When the client respond how i can get the response from the client . Can you please provide me with a simple application ?
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 19 May 2014 in reply to Spiros Link to this post

    Hi Spiros,

    Please have a look into the sample code snippet to achieve your scenario.

    C#:
    RadWindowManager1.RadConfirm("Are you sure you want to exit?", "CallBackFunction", 500, 300, null, "Confirm");

    JavaScript:
    function CallBackFunction(args) {
        //args will return the response
    }

    Thanks,
    Shinu.
  6. Spiros
    Spiros avatar
    15 posts
    Member since:
    May 2010

    Posted 19 May 2014 in reply to Shinu Link to this post

    Thanks for your quick response. My problem is far more complex basically.
    From JS
        <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
            <script type="text/javascript" language="javascript">

                function openWin() {
                    var oWnd = radopen("RadProducts.aspx", "RadWindow1");
                }

                function clientShow(sender, eventArgs) {
                    var txtInput = document.getElementById("txtInput");
                    sender.argument = txtInput.value;
                }

                function clientClose(sender, args) {
                    if (args.get_argument() != null) {
                        var txtInput = document.getElementById("txtInput");
                        txtInput.value = args.get_argument();
                    }
                }

                function OnClientClose(sender, args) {
                    var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
                alert(args);
                ajaxManager.ajaxRequest(args);
            }

            </script>

        </telerik:RadScriptBlock>

    I can pass a textbox as a parameter but on the other form (Popup) i can not get from the
    server the value sended

        <script type="text/javascript" language="javascript">

            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow)
                    oWindow = window.radWindow;
                else if (window.frameElement.radWindow)
                    oWindow = window.frameElement.radWindow;
                return oWindow;
            }

            function pageLoad() {

                txtInput = document.getElementById('txtUserInput');
                txtSecond = document.getElementById('TextBox1');

                var currentWindow = GetRadWindow();
                txtInput.value = currentWindow.argument;
            }

            function returnArg() {

                var oWnd = GetRadWindow();
                oWnd.close(txtSecond.value);
            }

            function cancelAndClose() {
                var oWindow = GetRadWindow();
                oWindow.close(null);
            }

        </script>
            </telerik:RadScriptBlock>

    Any idea .
    Thanks
    Spyros
  7. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 May 2014 in reply to Spiros Link to this post

    Hi Spiros,

    Please have a look into the sample code snippet to pass value from parent page to Radwindow and from RadWindow to parent page.

    Parent Page ASPX:
    <telerik:RadTextBox ID="radtxtInput" runat="server" Label="Input">
    </telerik:RadTextBox>
    <br />
    <telerik:RadTextBox ID="radtxtOutput" runat="server" Label="Output">
    </telerik:RadTextBox>
    <br />
    <telerik:RadButton ID="radbtnOpenWin" runat="server" AutoPostBack="false" OnClientClicked="ShowDialoag" Text="Show Dialog">
    </telerik:RadButton>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" OnClientClose="OnClientClose">
    </telerik:RadWindowManager>

    Parent Page JavaScript:
    <script type="text/javascript">
        function ShowDialoag(sender, args) {
            var textbox = $find("<%=radtxtInput.ClientID%>");
            radopen("ShowDialog.aspx?TextBoxValue=" + textbox.get_value(), null);
        }
        function OnClientClose(oWnd, args) {
            var arg = args.get_argument();
            if (arg) {
                var txtValue = arg.txtValue;
                $find("<%=radtxtOutput.ClientID%>").set_value(txtValue);
            }
        }
    </script>

    RadWindow Page ASPX:
    <telerik:RadTextBox ID="radtxtAccept" runat="server">
    </telerik:RadTextBox>
    <telerik:RadButton ID="radbtnClosewin" runat="server" Text="Close with argument"
        AutoPostBack="false" OnClientClicked="returnToParent">
    </telerik:RadButton>

    RadWindow Page C#:
    protected void Page_Load(object sender, EventArgs e)
    {
        radtxtAccept.Text = Request.QueryString["TextBoxValue"];
    }

    RadWindow Page JavaScript:
    function returnToParent() {
        var oArg = new Object();
        oArg.txtValue = $find("<%=radtxtAccept.ClientID %>").get_value();
        var oWnd = GetRadWindow();
        if (oArg.txtValue) {
            oWnd.close(oArg);
        }
    }
    function GetRadWindow() {
        var oWindow = null;
        if (window.radWindow) oWindow = window.radWindow;
        else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
        return oWindow;
    }

    Hope this will helps you.
    Thanks,
    Shinu.
  8. Spiros
    Spiros avatar
    15 posts
    Member since:
    May 2010

    Posted 20 May 2014 in reply to Shinu Link to this post

    Thanks very much for your quick response.
    I just run the code and works fine .
    Thanks
    Spyros
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017