Showing posts with label time. Show all posts
Showing posts with label time. Show all posts

Monday, March 26, 2012

UpdatePanel + Scriptmanger and Respone.Redirect to (external time consuming ressource)

Hello,

As the title of my post suggest, i use Response.Redirect(http://..../download.ahsx) on submit of my form;

This works fine. The file is streamed to the users browser and my update panel displays the " loading data gif".

The problem is that when the external page returns, we are not notified of this and we keep displaying the "loading data gif".

Is there a client side event i should process to refresh the starting page?

Thanks

/kadji

Is Ajax of any help in such of situation at all?

Thanks

/Kadji


Hi,

I'm afraid AJAX cann't do this.

As you said, when the external page returns, the starting page is not notified keep displaying the "loading data gif".

I suggest you use a timer to hide the "loading data gif" manually.

Best Regards


You are correct.

Thanks

/Kadji


But then what would i be looking for in my timer tick?

My web application still has no idea of what is happening in my remote resource.

Any suggestion?

/Kadji


Sorry,I mean javascript timer,not AJAX timer.

More information,seehttp://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/

Best Regards


Hi Jin-Yu Yin,

Could you explain how a client side timer would let me know that my http handler has finished running?

Thanks

/Kadji

Saturday, March 24, 2012

updatepanel and "unknown error" popup already fix in AJAX?

Last time, I'm using atlas and when i'm using updatepanel, there is an "unknown error" popup after the session is expired. From what i know, that "unknown error" popup is a bug. Just want to know, is it the problem fixed already in AJAX?

i encountered same error with you, as last time using ATLAS.

now i changed to AJAX official release, the problem seem like gone.

everything works fine here.


thanx for the updateBig Smile

Updatepanel a fake?

Try the demo on http://atlas.asp.net/quickstart/atlas/samples/controls/UpdatePanel2_cs.aspx. Each time you hit the button a full page refresh occur. Is the updatepanel in the current state a fake?

I'm having the same experience on both the sample page and in my own test. What gives? The progress bar fires, you loose your scroll position and the back button is enabled. Sure seems like a full page refresh to me.

If you read the blog:http://www.nikhilk.net/AtlasM1.aspx, it says:

>>

<atlas:ScriptManager runat="server" id="scriptManager"EnablePartialRendering="true" />
One little attribute with lots of magic behind it. Rather than performing a real postback, we simulate a postback using the familiar XMLHTTP object (or in Atlas using the Web.Net.WebRequest class).

<<

If internally it's using XMLHTTP to call the server then you shouldn't be seeing the progress bar, loosing scroll position or having a back button enabled. My conclusion: there's a bug or UpdatePanel's ability is over-stated.


It's not a fake. Rather, it's just outdated.

If you're trying this out locally, then you have to recode few lines. For example...

Change:

<atlas:UpdatePanelrunat="server"ID="UpdatePanel1"Mode="Always">

<ContentTemplate>

<strong>

<spanstyle="text-decoration: underline">Shipping Address</span>:

</strong>

<br/>

<asp:LabelID="lblFirstLineShipping"runat="server"Font-Bold="False"></asp:Label><br/>

<asp:LabelID="lblSecondLineShipping"runat="server"></asp:Label><br/>

<asp:LabelID="lblThirdLineShipping"runat="server"></asp:Label><br/>

</ContentTemplate>

</atlas:UpdatePanel>

<asp:ButtonID="btnCopy"runat="server"Text="Same As Billing Address"OnClick="btnCopy_Click"CausesValidation="False"/>

To:

<atlas:UpdatePanelrunat="server"ID="UpdatePanel1"Mode="Always">

<ContentTemplate>

<strong>

<spanstyle="text-decoration: underline">Shipping Address</span>:

</strong>

<br/>

<asp:LabelID="lblFirstLineShipping"runat="server"Font-Bold="False"></asp:Label><br/>

<asp:LabelID="lblSecondLineShipping"runat="server"></asp:Label><br/>

<asp:LabelID="lblThirdLineShipping"runat="server"></asp:Label><br/>

<asp:ButtonID="btnCopy"runat="server"Text="Same As Billing Address"OnClick="btnCopy_Click"CausesValidation="False"/>

</ContentTemplate>

</atlas:UpdatePanel>

You could also have used <Triggers> to define this as well. Being that Atlas is a work-in-progress, it's understandable that samples may not work, but I wish someone would take care of bringing these samples up-to-date so that newbies like us can learn from them.


Sure enough, that seemed to do it. I just had to move the button and the thing being updated inside the UpdatePanel (or even in separate UpdatePanels) and it works great.

Thanks!


Yes, we haven't wuite caught up these samples. They'll be fixed up really soon :). Just to rre-iterate, the controls within a UpdatePanel will aautomatically cause an async callback but controls outside the UpdatePanel will now still perform a regular postback, unless they are tied to UpdatePanels through triggers.

UpdatePanel and Default Button

There is nothing special about my ASP.NET code below. I have a label inside the update panel, and Button1, when pressed, sets the current time to the Label.

The only thing is, Button1 is the form's default button.

It works flawlessly in the development environment. I can press ENTER endlessly and it will work without postbacks. However, in the target environment, I observe very strange behaviors.

* Pleasecheck out the pageI have on my test server. Place your cursor inside one of the text boxes and press ENTER. It works. Now press ENTER again, Then it posts back. Every other time, it posts back.

* In my actual application, again it works in the development environment. But when ENTER is pressed the second time, I get a popup box that says,

Sys.WebForms.PageRequestManagerParserException:the message received from the server could not be parsed. Commoncauses for this error are when the response is modified by calls toResponse.Write(), response filters, HttpModules, or server traceenabled.Details: Error parsing near

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server" defaultbutton="Button1">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />
<br />
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>

<asp:Button ID="Button2" runat="server" Text="Not Default" />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click1" Text="Default" />
</div>
</form>
</body>
</html>

Can you give your server side code.So i can find out your problem's solution.


There is very little to the server side code. Here
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partialclass _Default : System.Web.UI.Page
{

protected void Button1_Click1(object sender, EventArgs e)
{
Label3.Text ="Default button pressed. Time is " + DateTime.Now.ToString();
}
}


I think when hitting enter you are going of Focus on your app. Perhaps at the end of your method you can get focus back on your textbox through javascript or your method.

function focuxtextbox () {

document.getElementById('textbox').focus();

}


vicpal25:

I think when hitting enter you are going of Focus on your app. Perhaps at the end of your method you can get focus back on your textbox through javascript or your method.

Well, losing the focus is not the issue. It posts back every other time when I press ENTER. That it redraws the whole page every other time is a problem. When you just press the button, it works, but not when you press ENTER.


Hum, yeah I was checking out your sample app. Interesting behavior. Have you tried passing the:

UpdateMode="Conditional"

to the udpate panel?


vicpal25:

Hum, yeah I was checking out your sample app. Interesting behavior. Have you tried passing the:

UpdateMode="Conditional"

to the udpate panel?

Yes I did. Same behavior.


hello.

well, the problem is that you're partial postback isn't re-registering the button as the default button. you can see this by using fiddler. i've tried hosting the app on my machine, but iis is working correctly here. can you debug the app on the server and see the value of the _requireFocusScript field during the pre-render event of the page?


Luis Abreu:

can you debug the app on the server and see the value of the _requireFocusScript field during the pre-render event of the page?

I've noted this behavior only on the target machine, not on my development machine. So how would I go about debugging the value of the _requireFocusScript?


hello again.

yes, here on my machine i'm not seeing that behavior too. i only see it when i try to load the page from the server where you've deployed the app

well, you'll have to add a method that handlers the prereder event and then you'll have touse the watch window since you'll have to go through several non public fields:

manager._pageRequestManager._requireFocusScript


Problem resolved. Well, kinda.

A windows update for .NET fromwork 2.0 fixed it. However, it now only works for IE, but not for Firefox. I suspect that is a different issue all together.

UpdatePanel and FileUpload control revisited one more time

I've seen nothing but real janky solutions to the problem at hand. That problem being that fileupload doesnt appear to be working on an update panel.

I've done a signifigant ammount of research and understand WHY it occurs, but not if theres any real way to circumvent the problem. I was wondering if anyone has been able to make a signifigant difference where fileupload could occur and not initiate a full postback.

I am using july ctp.

Anything that can be done?

I ran into exact problem. Only solution, by my opinion is to use client button control, and manage fileupload with javascript. Unfortunatelly I don't know javascript nor I have time to learn it :(
What is the problem putting a (invisible) button outside the update- panel and the upload- button inside the panel. Then you add a new eventhandler to the outside- button and process the things you want to there (save the file, show the file, redirect, ...).

The last thing you have to do is to trigger the outside- button event if the inner button is clicked. you just have to add a onclick- attribute: InnerButton.Attributes.Add("onclick", Page.ClientScript.GetPostbackEventReference(OutsideButton, ""))

ollifant

Nice, but there are still few problems:

- fileUpload control has its property "hasFile" set to'true' only if second time fire button click event (first time nothing happened)

- page still refreshs whole content even if i add button to trigger collection of update panel

forgive me my poor english


FileUpload controls when they are used to upload files as part of an asynchronous postback.

See for more details..

http://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx

Wednesday, March 21, 2012

Updatepanel and Gridview

Hi !

I'm trying to use Atlas for the first time and i seem to have some problem. I'm juste trying to use paging et sorting without refresh but it doesn't work. I have no error it just doesn't do anything. Here is my code:

<asp:ContentID="Content1"ContentPlaceHolderID="Contenu"Runat="Server">

<atlas:ScriptManagerID="sc2"EnablePartialRendering="true"runat="server"/>

<atlas:UpdatePanelID="p1"runat="server">

<ContentTemplate>

<asp:GridViewID="GridView1"runat="server"AllowPaging="True"AllowSorting="True"

AutoGenerateColumns="False"DataKeyNames="RéfIndis"DataSourceID="dsTest">

<Columns>

<asp:BoundFieldDataField="RéfIndis"HeaderText="RéfIndis"InsertVisible="False"

ReadOnly="True"SortExpression="RéfIndis"/>

<asp:BoundFieldDataField="RéfPosteDeCharge"HeaderText="RéfPosteDeCharge"

SortExpression="RéfPosteDeCharge"/>

<asp:BoundFieldDataField="RéfMachine"HeaderText="RéfMachine"SortExpression="RéfMachine"/>

<asp:BoundFieldDataField="DateDébut"HeaderText="DateDébut"SortExpression="DateDébut"/>

<asp:BoundFieldDataField="DateFin"HeaderText="DateFin"SortExpression="DateFin"/>

<asp:BoundFieldDataField="Motif"HeaderText="Motif"SortExpression="Motif"/>

</Columns>

</asp:GridView>

<asp:SqlDataSourceID="dsTest"runat="server"ConnectionString="<%$ ConnectionStrings:OrchestraCI2K %>"

SelectCommand="SELECT [RéfIndis], [RéfPosteDeCharge], [RéfMachine], [DateDébut], [DateFin], [Motif] FROM [Indisponibilités Machines]">

</asp:SqlDataSource>

</ContentTemplate>

</atlas:UpdatePanel>

</asp:Content>

Did i do some mistakes?

Thanks!!!

It looks okay. When you say that it's not working, do you mean that it's still posting back (with flicker) or something else? Also, I noticed that you're using MasterPage. Did you perhaps do something special in the MasterPage (like using the Atlas features there too)? I tried a simple example and everything works fine, including when used with MasterPage.

Same with me. I got the same error with my gridview. No flicker, no error, no result. Can somebody can post code for gridview and atlas that works on his/her app?

Thank you!


this works for me...

<atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
</atlas:ScriptManager>
<atlas:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<img src="http://pics.10026.com/?src=gfx/indicator.gif" />
Loading...
</ProgressTemplate>
</atlas:UpdateProgress>
<atlas:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<atlas:ControlEventTrigger ControlID="gridUsers"EventName="SelectedIndexChanged" />
</Triggers>
<ContentTemplate>
<asp:Panel Width="268px" Height="240px" runat="server" ID="pnlUsers"ScrollBars="Vertical">
<asp:GridView ID="gridUsers" runat="server"AutoGenerateColumns="False" ShowHeader="False"
Width="248px" BorderStyle="None" Height="15px"EditRowStyle-ForeColor="Gray" OnRowDataBound="gridUsers_RowDataBound"OnSelectedIndexChanged="gridUsers_SelectedIndexChanged"OnRowCommand="gridUsers_RowCommand" >
<SelectedRowStyle Font-Bold="true" />
<Columns>
<asp:TemplateField>
<ItemStyle BackColor="#E0E0E0" BorderColor="White"BorderStyle="Solid" BorderWidth="2px"
Height="23px" HorizontalAlign="Left" VerticalAlign="Middle"Width="125px" />
<ItemTemplate>
<asp:LinkButton ID="linkUserSelect" runat="server"CausesValidation="False" CommandName="Select" CommandArgument='<%#Eval("idUser") %>'
OnClick="linkUserSelect_OnClick" ForeColor="#696969"Font-Underline="false" Text='<%# Bind("chrName")%>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="EE">
<ItemStyle Height="23px" Width="35px" VerticalAlign="Middle"HorizontalAlign="Center" BackColor="#E0E0E0" BorderStyle="Solid"BorderColor="White" BorderWidth="2px" />
</asp:BoundField>
<asp:BoundField DataField="Recd">
<ItemStyle Height="23px" Width="35px" HorizontalAlign="Center"BackColor="#E0E0E0" BorderStyle="Solid" BorderColor="White"BorderWidth="2px" />
</asp:BoundField>
<asp:TemplateField>
<ItemStyle Width="45px" Height="23px" VerticalAlign="Middle"HorizontalAlign="Center" BackColor="White" BorderStyle="None" />
<ItemTemplate>
<asp:ImageButton ID="imgActivate" runat="server" Width="45px"Height="23px" CommandName="Select"
CommandArgument='<%# Eval("idUser") %>' AlternateText='<%#Eval("Act") %>' ToolTip="Activate" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EditRowStyle ForeColor="Gray" />
</asp:GridView>
</asp:Panel>
</div>
<span style=" text-align: right;"></span>
</ContentTemplate>
</atlas:UpdatePanel>
</asp:Content

for me not :( Could you have a look to my code and tell me what is wrong, please?

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
</atlas:ScriptManager>
<atlas:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>

</ProgressTemplate>
</atlas:UpdateProgress>
<atlas:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<atlas:ControlEventTrigger ControlID="GridView1" EventName="SelectedIndexChanged" />
</Triggers>
<ContentTemplate>


<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="ProductID" DataSourceID="SqlDataSource1"
EmptyDataText="">
<Columns>
<asp:CommandField ShowEditButton="True" ShowSelectButton="True" />
<asp:BoundField DataField="ProductID" HeaderText="Product ID" ReadOnly="True" SortExpression="ProductID" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />

</Columns>
</asp:GridView>

</ContentTemplate>
</atlas:UpdatePanel>
... cut code from the select statmenet
</asp:Content>


jcasp wrote:

It looks okay. When you say that it's not working, do you mean that it's still posting back (with flicker) or something else? Also, I noticed that you're using MasterPage. Did you perhaps do something special in the MasterPage (like using the Atlas features there too)? I tried a simple example and everything works fine, including when used with MasterPage.

Thank for youy reply! When i say that it's not working i mean that when i click on the header to sort a column or when i click in the number of the page to change the page of my gridview nothing occur. No post-back, no flickering. I will try to do the same page without my masterpage. I dont think this is the problem but i'm using callback in this master page so maybe it could be the problem.


Ok i've try to do the same this but this time without my masterpage and this is working. So the problem is my masterpage. In this masterpage i'm using callback. The users can start some fonctions that generate reports and when this occurs i'm using callback to display a progress bar at the bottom of all my page and for all the users. If i'm already using callback and i want to use Atlas did i have to change something in my code or if it should work without i change something?

Thank and sorry about my bad english ^_^


<trigger> missingSianspheric .

Uffy wrote:

<trigger> missingSianspheric .

<trigger> is not required if the control is enclosed within <UpdatePanel>.

Sianspheric wrote:

Ok i've try to do the same this but this time without my masterpage and this is working. So the problem is my masterpage. In this masterpage i'm using callback. The users can start some fonctions that generate reports and when this occurs i'm using callback to display a progress bar at the bottom of all my page and for all the users. If i'm already using callback and i want to use Atlas did i have to change something in my code or if it should work without i change something?

Thank and sorry about my bad english ^_^

See if you can change your MasterPage's callback processing to Atlas-based on as well.

jcasp wrote:

Uffy wrote:

<trigger> missingSianspheric .

<trigger> is not required if the control is enclosed within <UpdatePanel>.

Could you backup your statement with source please. It will help newbies like me to understand things better.

My reasons come from:

http://west-wind.com/weblog/posts/4719.aspx

And

http://weblogs.asp.net/atlas/archive/2006/02/08/437758.aspx

And

http://www.dotnetslackers.com/Atlas/re-23004_ATLAS_UpdatePanel_Experiments.aspx

I did not see any example without <triggers> - am I missing something?

Thanks.


I want to make templet for GridView.In which each cell contain updatepanel control.Whenevery i add new row or column that newly add cell also having that updatepanel. How to do this...

UpdatePanel causing non async postback

Hi.

I'm trying to wire up a page with a control in it using ajax and update panels, but each time I try the whole page is posted back. Obviously there's something I'm missing.

So this is what I have:

Home.aspx -> (containing) myControl.ascx

myControl.ascx is a datagrid wrapped with an updatepanel

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><asp:UpdatePanel ID="UpdatePanel1" runat="server" EnableViewState="true" ChildrenAsTriggers="true" UpdateMode="Conditional"> <ContentTemplate> /* myDatagrid here */ </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="myDatagrid" /> </Triggers></asp:UpdatePanel>

The whole page (home.aspx) is posted back when one of the edit / update columns in the datagrid is pressed.
Please help

If you want to specify asynchronous post back for a control, you should specify the corresponding event name at the same time. Here are some sample codes for your reference.
<asp:ScriptManager ID="ScriptManager1" runat="server"EnablePartialRendering="true">
</asp:ScriptManager>
<asp:UpdatePanel ID="upnlGridView0" runat="server"ChildrenAsTriggers="false" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="gv" runat="server" OnRowCommand="gv_RowCommand"></asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="gv" EventName="RowCommand" />
</Triggers>
</asp:UpdatePanel
Wish the above can help you.