This is a migrated thread and some comments may be shown as answers.

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

5 Answers 403 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 03 Nov 2010, 07:20 PM
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.

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 04 Nov 2010, 12:51 PM
Hello Scott,


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


-Shinu.
0
Scott
Top achievements
Rank 1
answered on 04 Nov 2010, 03:32 PM
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.
0
Yana
Telerik team
answered on 05 Nov 2010, 04:19 PM
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
0
Scott
Top achievements
Rank 1
answered on 06 Nov 2010, 04:35 AM
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.
0
Scott
Top achievements
Rank 1
answered on 07 Nov 2010, 02:07 AM

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.

Tags
ToolBar
Asked by
Scott
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Scott
Top achievements
Rank 1
Yana
Telerik team
Share this question
or