Showing posts with label activate. Show all posts
Showing posts with label activate. Show all posts

Wednesday, March 28, 2012

UpdateProgress with a Response.Redirect

I have an UpdateProgress control to activate on a postback of a button control. The button_click event is performing a Response.Redirect to pull up a Report from SQL Reporting Server. The report comes up and the UpdateProgress bar is spinning on the page with the button. However, once the user closes the report and control is returned to the page, the UpdateProgress image is still there spinning.

How can I make the UpdateProgress bar to finish and go away?

Thanks,

Paul

Could you please post your code.

Is the UpdateProgress control inside an updatepanel?

JoeWeb


The UpdateProgress is outside of the UpdatePanel.

Protected

Sub ImgButPrint_Click(ByVal senderAsObject,ByVal eAs System.Web.UI.ImageClickEventArgs)Handles ImgButPrint.Click

Response.Redirect(PrintReports.printSchedule("Schedule3", Session.Item("companyId"), Session.Item("year"), 0))EndSub

The UpdateProgress displays a spinning wheel while the response.redirect happens. The Response.Redirect is opening a report from the report server as a .pdf file. So the redirect pops up a dialog asking user either to Open, Save, or Cancel the .pdf report file. Once the user selects their option and control is returned back to the original page the UpdateProgress image is still on the screen.

Monday, March 26, 2012

updating panelsize within scriptmanager

I need some help.

I have a masterpage with a scriptmanager surrounding my contentplaceholder. When I activate my defaultpage using the masterpage, the page_load reads in javascriptcode (RegisterStartupScript). This code runs at window::load(). The effect is that the size of a panel-component inside the contentplaceholder is set depending on the size of the window.

That works fine.

But when I read in the default-page again (using a button) the onload-event is not activated. That is the one of the good things in ATLAS, but it gives me a little problem: The size of the panel-control gets at new size according to the amount of data within the panel.

What do I have to do, when I want the size of panel to stay unchanged ?

I hope you understand my problem even thought my english is not the best.

hi sixtus,

I think i encountered the same problem !
the solution I found is :


<%@. Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="testGbControls._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
function resizeMe()
{
document.getElementById('panel').style.height = 200;
document.getElementById('panel').style.width = 200;
}

function PageRequestManagerPropertyChanged(sender, args)
{
if (args.get_propertyName() == "inPostBack")
{
if (!$object("_PageRequestManager").get_inPostBack())
resizeMe();
}
}
function pageLoad()
{
$object("_PageRequestManager").propertyChanged.add(PageRequestManagerPropertyChanged);
}
</script>
<script runat="server"
protected void btn_Click(object sender, EventArgs e)
{
this.content.Text += "ligne" + "<br> ";
}
</script>
</head>
<body onload="resizeMe()">
<form id="form1" runat="server">
<div id="panel" style="background-color:Red;overflow:scroll;width:100;height:100;">
<atlas:ScriptManager runat="server" ID="mngr" EnablePartialRendering="true" EnableScriptComponents=true >
</atlas:ScriptManager>
<atlas:UpdatePanel runat="server" ID="updpnl">
<ContentTemplate>
<asp:button ID=btn runat=server OnClick="btn_Click" />
<asp:label id=content runat=server Text="ligne"></asp:label>
</ContentTemplate>
</atlas:UpdatePanel>
</div>
</form>
</body>
</html>

the div "panel" is resize on each atlas postback
I hope this help you
Gildas

Unfortunately it doesn't solve my problem, because I am using Masterpages. Or I haven't totally understood the solution.

You can se my problem onhttp://localhost/scripts/ASP.NET/Oresund2/Vis/opslag.aspx?id=1

When the page is read the lightbrown panel has the right dimensions. When I click the Tekst-button in the panel, the panel keeps its dimensions as it should. Because the page is re-read I figure.

But if I choose Fredensborg in the Treeview (no postback I think) the dimensions in the panel is changed.

How do I solve that problem when then treeview and the panel isn't placed in the masterpage but in the aspx-file?


Sorry - the link was wrong. Here is the correct one:

https://temp.eg-gym.dk/scripts/asp.net/Oresund/vis/opslag.aspx?id=1


hi,
Is your lightbrown panel a <div> sizing by a javascript on load ?
can you post the code of your panel please

It looks like you got some good stuff going already on your UpdatePanel. My example might still help from the standpoint that I assure, using my method there, that the host control COULD always stay the same size (although it might not be obvious in the presentation because I don't enforce it).


I don't use a div but <asp:panel...>.

The code in page_load is:

If (Not ClientScript.IsClientScriptBlockRegistered("SetPanelScript"))Then

Dim sbScriptAsNew System.Text.StringBuilder

sbScript.Append("<script language=JavaScript>" & vbCrLf)

sbScript.Append("function opdater()" & vbCrLf)

sbScript.Append("{" & vbCrLf)

sbScript.Append(" var windowHeight = -1;" & vbCrLf)

sbScript.Append(" var windowWidth = -1;" & vbCrLf)

sbScript.Append(" if ( window.innerWidth ) {" & vbCrLf)

sbScript.Append(" windowWidth = window.innerWidth;" & vbCrLf)

sbScript.Append("}" & vbCrLf)

sbScript.Append(" else if ( (document.documentElement) && (document.documentElement.clientWidth) ) {" & vbCrLf)

sbScript.Append(" windowWidth = document.documentElement.clientWidth;" & vbCrLf)

sbScript.Append("}" & vbCrLf)

sbScript.Append(" else if ( document.body.clientWidth ) {" & vbCrLf)

sbScript.Append(" windowWidth = document.body.clientWidth;" & vbCrLf)

sbScript.Append("}" & vbCrLf)

sbScript.Append(" if ( windowWidth > 335 ) {" & vbCrLf)

sbScript.Append(" document.getElementById('" +Panel1.ClientID +"').style.width = windowWidth - 335;" & vbCrLf)

sbScript.Append(" }" & vbCrLf)

sbScript.Append(" if ( window.innerHeight ) {" & vbCrLf)

sbScript.Append(" windowHeight = window.innerHeight;" & vbCrLf)

sbScript.Append("}" & vbCrLf)

sbScript.Append(" else if ( (document.documentElement) && (document.documentElement.clientHeight) ) {" & vbCrLf)

sbScript.Append(" windowHeight = document.documentElement.clientHeight;" & vbCrLf)

sbScript.Append("}" & vbCrLf)

sbScript.Append(" else if ( document.body.clientHeight ) {" & vbCrLf)

sbScript.Append(" windowHeight = document.body.clientHeight;" & vbCrLf)

sbScript.Append("}" & vbCrLf)

sbScript.Append(" if ( windowHeight > 110 ) {" & vbCrLf)

sbScript.Append(" document.getElementById('" +Panel1.ClientID +"').style.height = windowHeight - 120;" & vbCrLf)

sbScript.Append(" }" & vbCrLf)

sbScript.Append("}" & vbCrLf)

sbScript.Append("window.onload=opdater" & vbCrLf)

sbScript.Append("</script>" & vbCrLf & vbCrLf)

ClientScript.RegisterClientScriptBlock(GetType(String),"SetPanelScript", sbScript.ToString())

EndIf

InTreeView1_SelectedNodeChanged I have got the advice to write the following, but it doesn't work.

Dim scriptKeyAsString ="setPanelScript"

Dim sbScriptAsNew System.Text.StringBuilder()

sbScript.Append("<script language=JavaScript>" + ControlChars.Lf)

sbScript.Append("<!--" + ControlChars.Lf)

sbScript.Append("opdater2();" + ControlChars.Lf)

sbScript.Append("// -->" + ControlChars.Lf)

sbScript.Append("</script>" + ControlChars.Lf)

ClientScript.RegisterClientScriptBlock(GetType(String), scriptKey, sbScript.ToString())

The panel is resized correct when the whole page is reread, but the size is changing when I select a item in the treeview.