How can I force a specific button in a Toolbar to do a full postback within an UpdatePanel?

6 posts, 0 answers
  1. Scott
    Scott avatar
    5 posts
    Member since:
    Aug 2010

    Posted 03 Nov 2010 Link to this post

    Hello,

    I would like to know how to go about adding code or a property to a button on a radToolbar that would force a FULL postback, even though the radToolbar is contained within an UpdatePanel?

    I need this because I am writing a file to the browser upon postback and I cannot do that unless a FULL postback occurs.

    Thank you.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 04 Nov 2010 Link to this post

    Hello Scott,


    Here I found a relevant documentation. Please go through this and see whether it helps.
    Exclude controls from ajaxifying


    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Scott
    Scott avatar
    5 posts
    Member since:
    Aug 2010

    Posted 04 Nov 2010 Link to this post

    I've seen that post before, however, it doesn't QUITE solve my problem.

    My problem is that I need to do something for a radToolbarButton WITHIN a radToolbar.  I can take advantage of the OnClientButtonClicking event of the Toolbar to inspect WHICH button was clicked, but I am unsure as to what to put IN this function to force a full postback.

    Your guidance would be welcomed.
  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 05 Nov 2010 Link to this post

    Hello Scott,

    You can use RadAjaxManager's set_enableAjax()  client method to enable/disable the ajax in OnClientButtonClicking event handler.

    Regards,
    Yana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Scott
    Scott avatar
    5 posts
    Member since:
    Aug 2010

    Posted 05 Nov 2010 Link to this post

    I'm sorry.  I should have indicated in my original post that I am using the ScriptManager from the .NET Framework rather than the RadAjaxManager.  Actually, with .NET 4.0, we are using the ToolkitScriptManager.

    Can you please help me with a solution that will allow me to cause a radToolbarButton WITHIN a radToolbar to do a full postback, while using the STANDARD .NET ScriptManager?

    I can take advantage of the OnClientButtonClicking event of the Toolbar to inspect WHICH button was clicked, but I am unsure as to what to put IN this function to force a full postback.
  7. Scott
    Scott avatar
    5 posts
    Member since:
    Aug 2010

    Posted 06 Nov 2010 Link to this post

    Ah, I found a solution.

    1. Inside the UpdatePanel, I created a standard ASP:Button control and set the visibility to hidden.
    <asp:Button ID="btnHiddenButton" runat="server" Text="Hidden" CausesValidation="false" OnClick="btnHiddenButton_Click" Style="displaynonevisibilityhidden;" />

    2. I added a PostBackTrigger for that Button
            <Triggers>
                <asp:PostBackTrigger ControlID="btnHiddenButton" />
            </Triggers>

    3. In the OnClientButtonClicking event of the toolbar, I cancel the click event of the toolbar button and call the .click() event of the button.

    	<script type="text/javascript">
    function radActions_OnClientClicking(sender, args) {
    var button = args.get_item();

    switch (button.get_value()) {
                        case "idToolbarButtonToClick":
                                    // cancel the toolbar button click and call the click event of the hidden button, so we can cause a FULL Postback
                            args.set_cancel(true);
                            document.getElementById("<%=btnHiddenButton.ClientID%>").click();
                            break;
    }
    }
    </script>

    In my code-behind, I had an event handler setup for the button to do what I wanted.

    Results:  FULL Page Postback via one toolbar button.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017