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

Postback run code behind

1 Answer 188 Views
Window
This is a migrated thread and some comments may be shown as answers.
Paulo Goncalves
Top achievements
Rank 2
Paulo Goncalves asked on 30 May 2008, 01:46 AM
Hi,

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.

Thanks



 

1 Answer, 1 is accepted

Sort by
0
Accepted
Tervel
Telerik team
answered on 30 May 2008, 04:17 PM
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" ..../>
</div>

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:
http://www.telerik.com/DEMOS/ASPNET/Prometheus/Window/Examples/DialogReturnValue/DefaultCS.aspx

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.

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

Regards,
Tervel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Window
Asked by
Paulo Goncalves
Top achievements
Rank 2
Answers by
Tervel
Telerik team
Share this question
or