I have made a ToolBar usercontrol in a update panel. All buttons should work client side except a print button. I want to make t开发者_C百科his use the original postback.
ScriptManager.GetCurrent(Me).RegisterAsyncPostBackControl(Toolbar2.PrintButton)
However the button still doesn't refresh the page...
Any ideas?
You must set AutoPostBack to true? of the PrintButton that you have created
Rather than using the script manager to register a control as asynchronous, instead set the button as a trigger on the update panel itself, which you also can do via code.
HTH.
When you use RegisterAsyncPostBackControl you must also manually refresh the update panel using the Update() method. http://geekswithblogs.net/lszk/archive/2011/08/08/playing-with-update-panels.aspx
You can use the Triggers property of the UpdatePanel to register actions that trigger a full postback.
Add a PostBackTrigger object to that property, containig the ControlID of the control which needs to trigger a full postback.
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
<ContentTemplate>
...
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="myFullPostBackControlID" />
</Triggers>
</asp:UpdatePanel>
精彩评论