I have a control inside of an UpdatePanel
. The UpdatePanel
has an AsyncPostBack
trigger associated with the inner control. This works just fine.
I have another control containing a SSRS ReportViewControl
that I would like to conditionaly hide based on the results from the postback event of the UpdatePanel
mentioned above.
The ReportViewerControl
is not inside of an UpdatePanel
and I would like to keep it this way. How can I hide the ReportViewerControl
based on the postback event of an UpdatePanel
inside of another control?
I am assuming that many problems would spring up if I place the ReportViewerControl
inside of an UpdatePanel
, anyone know for sure?
You could create a script inside you update panel content template and hide your control form javascript.
<script type="text/javascript">
Sys.Application.Add_load(MyFunctionThatHides);
</script
The ReportViewerControl is not inside of an UpdatePanel and I would
like to keep it this way.
I did a simple trick. I created a another Updatepanel and put a literal control side the update panel and this update panel code Is Above the "Control you want to hide"
something like this
<asp:UpdatePanel ID="UpdatePanel5" runat="server" UpdateMode="Always" >
<ContentTemplate>
<asp:Literal runat="server" ID="literal1"></asp:Literal>
</ContentTemplate>
</asp:UpdatePanel>
Then in Code behind I inject CSS
something like this
literalDvControl.Text = "<style> #YourControlID{ display:none;}</style>";
This seems to be working. Basically literal control is injecting style tag and browser is very quick to react.
but do read about this .
Using <style> tags in the <body> with other HTML
You can use following code after processing the Async AJAX call on server and just before returning the response to client/browser
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowHideReportViewerJSScript", <JS code to show/hide reportviewer>, true);
I assume you have scriptmanager placed on the ASPX page