Reputation: 986
I have a selection dialog that is being displayed by a RadToolTipManager. The dialog consists of a few inputs, a RadGrid and a button within a User Control. When the user clicks the button, the selection dialog is closed. The code behind the button is working, and the information is being passed back to the page through an event handler. However, the page doesn't refresh its controls with the new data.
I determined that RadToolTipManager requires use of Ajax calls, and I added the RadAjaxManager to the page and a RadAjaxManagerProxy to the User Control. But I don't know how to get the button within the User Control to initiate an Ajax request for the controls on the page.
From what I've researched, I need to initiate an AjaxRequest or a __doPostBack for the page. The latter would be fine, its practically the entire page that will need to be updated.
I'm just not experience with javascript/client side programming. Do I attach it to the Button in the user control? Seems like that would fire the client script before the code behind. The code behind is what loads the data into the controls that need to be updated. And I'm not sure how to get then name of the page (or panel on the page) for the eventTarget parameter.
Any help is appreciated.
Upvotes: 1
Views: 2477
Reputation: 986
I did get help from Telerik support on this. I had the RadAjaxManager updating incorrectly. I was able to get done what I needed by having the RadToolTip trigger the update via the RadAjaxManager.
That said, this is a very "Telerik" solution. I prefer to use third party libraries only where they really improve the design. rdmptn's solution is much more generic, so giving him the nod.
Upvotes: 0
Reputation: 5603
There is an easier way that will do that in one postback, without any JavaScritp.
Let's say that Panel1 is the container that you wish to update when the button in the user control is clicked.
Wrap Panel1 in an
<asp:UpdatePanel runat="server" id="up1" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel id="Panel1" runat="server"></asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
In the code-behind call its Update() method (in the handler your button already invokes). Repeat for all separate containers that you wish to update. That's how AJAX works :)
Upvotes: 1
Reputation: 50728
In your user control code-behind, you could try adding a property like:
public string ButtonID {
get { return ButtonControl.ClientID; }
}
And programmably add the entry to the RadAjaxManager. Not sure if that would work; the workaround is wrap all the contents in a RadAjaxPanel.
Upvotes: 0