Reload User control 1 from User control 2 button click

Posted by Community Admin on 04-Aug-2018 09:15

Reload User control 1 from User control 2 button click

All Replies

Posted by Community Admin on 24-Oct-2011 00:00

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

Posted by Community Admin on 25-Oct-2011 00:00

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

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 26-Oct-2011 00:00

Hi Boyan,

This is my UC2 method I wanna call : 

public void MethodUC2()
    BindData();
    updPanel.Update();

And this is my button click method in UC1  : 

protected void myButton_Click(object sender, EventArgs e)
    // I want to call MethodUC2()

But the user controls don't know each other so I can't call MethodUC2 in my UC1. How can I do that?

Thanks for your help,

Fabien

Posted by Community Admin on 26-Oct-2011 00:00

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

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 26-Oct-2011 00:00

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

Posted by Community Admin on 31-Oct-2011 00:00

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

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 07-Nov-2011 00:00

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

Posted by Community Admin on 10-Nov-2011 00:00

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

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed