Reload User control 1 from User control 2 button click
Hi,
I have two user controls in my page. When I click on a button from UC1 I want UC2 to reload (call a method in fact). For the moment my entire page is reloading on button click. It's not efficient at all. How can I do that?
PS : for information my user controls are registered in toolboxes.
Thanks for your help,
Fabien
Hi Fabien,
Can you please let us know a little bit more information about your user control and the logic behind it (maybe you could share the sample implementation with us) so we can give you a more specific advice. Generally if you want to avoid full postbacks, I'd recommend you to wrap the control in RadAjaxPanel and configure it in a similar manner to the explanation we have given in our latest reply on this forum thread. If any problems persist, please let us know.
All the best,
Boyan Barnev
the Telerik team
Hi Boyan,
This is my UC2 method I wanna call :
public
void
MethodUC2()
BindData();
updPanel.Update();
protected
void
myButton_Click(
object
sender, EventArgs e)
// I want to call MethodUC2()
Hello Fabien,
In that case you might try implementing some logic so your controls can pass parameters through the URL by querystring, this forum thread contains a rather long discussion and code samples on the topic, I believe you might find it useful. Alternatively you might want to take a look at HttpContext.Items.
Kind regards,
Boyan Barnev
the Telerik team
Hi Boyan,
Sorry but I don't want to pass parameters from UC1 to UC2. For the moment when I click on button from UC1 I must reload all the page to reload my UC2. But it takes too long time. I just wanna reload "on the fly" my UC2 when I click on button from UC1, without reload all the page. Do I make myself clear? Because I'm not a good english writter.
Thanks for your help,
Fabien
Hi Fabien,
In that case wouldn't wrapping the control in a RadAjaxPanel like we suggested in our initial reply suit your purposes - this would ensure that only that part of the page will update.
Greetings,
Boyan Barnev
the Telerik team
I wrap my UC2 in a RadAjaxPanel. When I click on my UC1 button my UC2 doesn't reload. The problem is that my two UC are in the same page but unlinked. So the postback of UC1 doesn't reload UC2...
Thanks for your help,
Fabien
Hi Fabien,
Thank you for the clarification. In case the controls share one functionality - that is they should work together, why not wrap them together i a single user control and use RadAjaxPanel or UpdatePanel?
All the best,
Boyan Barnev
the Telerik team