Postback run code behind

2 posts, 1 answers
  1. Paulo Goncalves
    Paulo Goncalves avatar
    26 posts
    Member since:
    Aug 2004

    Posted 29 May 2008 Link to this post


    I have two pages one is the main with open another that is a RadWindow, at RadWindow have a Treeview, I would like when each treeview node is click one code behind at first page is fired and dont´t close the RadWindow.


  2. Answer
    Tervel avatar
    1337 posts

    Posted 30 May 2008 Link to this post

    Hello Paulo,

    Your scenario is not possible to implement in the way you want it.
    The rad window control is not a separate browser window. It is a DHTML control that resides on the main page (that is, the page which you want to reload every time a tree node in the rad window is clicked). Of course, reloading the main page will cause the rad window to be destroyed as well - as it is a part of this page.

    However, it is possible to implement what you need by using AJAX and just a line or two of client-side code to start the AJAX request. AJAX requests perform partial, rather than complete page updates, and it is very easy to use with Telerik RadControls.

    Here is one possible way for you to proceed:

    1. Wrap your page content (except the RadWindow/RadWindowManager declaration) into a <asp:UpdatePanel>
    2. Add a hidden button into this panel, which you will use to make a programmatic AJAX request to the server. To hide the button you should add it to a hidden DIV, e.g.
    <div style="display:none">
    <asp:Button id="HiddenButton" ..../>

    3. Next - when you open your RadWindow and return a value from the treeview, you might need to set it to a hidden field, so as to use this value on the server. Here is a RadWindow demo that demonstrates setting and getting a value from a RadWindow that you need to use:

    4. Once you have returned the value from the treeview node and have set it into a hidden field, you are ready to perform the partial page update request. All you need to do is call the client-side click() method of the Button, e.g.

    //Perhaps this code is inside of some client-side function
    var button = document.getElementById("<%=HiddenButton.ClientID%>");;

    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top