1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Reload User control 1 from User control 2 button click

Reload User control 1 from User control 2 button click

8 posts, 0 answered
  1. Fabien
    Fabien avatar
    4 posts
    Registered:
    02 Sep 2011
    24 Oct 2011
    Link to this post
    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
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    16 Aug 2017
    25 Oct 2011
    Link to this post
    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
  3. Fabien
    Fabien avatar
    4 posts
    Registered:
    02 Sep 2011
    26 Oct 2011
    Link to this post
    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
  4. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    16 Aug 2017
    26 Oct 2011
    Link to this post
    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
  5. Fabien
    Fabien avatar
    4 posts
    Registered:
    02 Sep 2011
    26 Oct 2011
    Link to this post
    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
  6. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    16 Aug 2017
    31 Oct 2011
    Link to this post
    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
  7. Fabien
    Fabien avatar
    4 posts
    Registered:
    02 Sep 2011
    07 Nov 2011
    Link to this post
    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
  8. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    16 Aug 2017
    10 Nov 2011
    Link to this post
    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
8 posts, 0 answered