Showing posts with label postback. Show all posts
Showing posts with label postback. Show all posts

Monday, March 26, 2012

PageRequestManager Question

Hello,

I have an update panel which contains a gridview control. When the update panel refreshes or there is a partial postback I would like an indicator that this event has occured in my client side script. I plan to use an if/then statement based on this. I believe this can be done by using an instance of the PageRequestManager class. Could you provide an example of this?

Thanks,

-Robert

It sounds like this tutorial goes over what you're looking for:

http://ajax.asp.net/docs/tutorials/AnimateUpdatePanels.aspx

In your handler for the pageLoaded event, you use the panelsUpdated property to figure out which panels were updated. You can then show whatever indicator you want based on that information.

PageRequestManager events being called too many times

I'm studying the PageRequestManager event lifecyle. It appears that when the number of times i click the linkbutton to perform the asynch postback, that same number of times the event is being called. Here's the scenario: I click the linkbutton once. Alerts for all events are called. I click the linkbutton once again. Alerts for all events are called twice. I click the linkbutton once again. Alerts for all events are called 3x. ... etc. Heres the sample code:

/*************************** aspx code ************************/

<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Path="AsynchronousLifeCycle.js" />
</Scripts>
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Date: "></asp:Label><br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Push me!" />
</ContentTemplate>
</asp:UpdatePanel>
</form>

/******** js code *************************************/

Sys.Application.add_load(ApplicationLoadHandler)
Sys.Application.notifyScriptLoaded();


function ApplicationLoadHandler(sender, args)
{
Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(InitializeRequest);
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequest);
Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(PageLoading);
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(PageLoaded);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest);
}

function InitializeRequest(sender, args)
{
alert("InitializeRequest");
}

function BeginRequest(sender, args)
{
alert("BeginRequest");
}

function PageLoading(sender, args)
{
alert("PageLoading");
}

function PageLoaded(sender, args)
{
alert("PageLoaded");
}

function PageLoaded(sender, args)
{
alert("PageLoaded");
}

function EndRequest(sender, args)
{
alert("EndRequest");
}

hi,

Please refer below URL:

http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageRequestManagerClass/PageRequestManagerBeginRequestEvent.aspx

Thanks

kishore

www.relgo.com.

Saturday, March 24, 2012

Paging a GridView with CSS Friendly Adapters causes a total postback with AJAX Beta1

Hello,

I have upgraded an existing project (Atlas CTP) to the Atlas Beta1 and encountered a problem with a GridView inside an UpdatePanel. I am using theCSS Friendly ASP.NET 2.0 Control Adapters for the GridView and paging the results causes a total postback instead of partial. Here's my code:

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> private System.Collections.Generic.List<string> GetList() { System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>(); for (int i = 0; i < 100; i++) { list.Add("item " + i.ToString()); } return list; } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ResultsGrid.DataSource = GetList(); ResultsGrid.DataBind(); } } protected void ResultsGrid_PageIndexChanging(object sender, GridViewPageEventArgs e) { ResultsGrid.PageIndex = e.NewPageIndex; ResultsGrid.DataSource = GetList(); ResultsGrid.DataBind(); }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <div> <asp:UpdatePanel ID="Updaty" runat="server"> <ContentTemplate> <asp:GridView id="ResultsGrid" runat="server" PageSize="10" AllowPaging="true" OnPageIndexChanging="ResultsGrid_PageIndexChanging" /> </ContentTemplate> </asp:UpdatePanel> </div> </form></body></html>

Using the Atlas CTP the same code caused a partial postback when paging the GridView. Any ideas?

Regards,
Darin

One way around this is to add a trigger to the UpdatePanel for the PageIndexChanging event.

<Triggers>
<asp:AsyncPostBackTrigger ControlID="ResultsGrid" EventName="PageIndexChanging" />
</Triggers>

I tried this and it seem to then update the panel incrementally as expected.


I posted a fix here...http://forums.asp.net/thread/1442598.aspx

Paging freeze after partial postback

HiI am a newbie to the AJAX stage, I created an application very similar in functionality as the to do list HDI video demo.My problem is when I do a partial page back and the new data is refreshed into my gridview the paging stops to function. You can click on the page numbers and there it will stay till I fire

a full page postback. I have an updatePanel with a Gridview and a dropdownlist included in the panel. The dropdownlist just selects different departments in our organization.

I set the updatePanel to conditionalupdate and specified my trigger as dorpdownlist selected index change, enabled the paging and enablepagingandsorting on my gridview.

What did I miss on my path to AJAX ?

Can you post your code where its freezing. Check with breakpoints?


hello.

if the dropdown is inside the panel, then you simply don't need to set up triggers.

btw, here's a quick example:

i have the following ona code file on app_code:

public class Obj
{
private Int32 _id;
private String _name;

public int Id
{
get { return _id; }
set { _id = value; }
}

public string Name
{
get { return _name; }
set { _name = value; }
}
}


public class ObjDS
{
public List<Obj> Get()
{
List<Obj> objs = new List<Obj>
{
new Obj{Id = 1, Name = "Luis"} ,
new Obj{Id = 2, Name = "Jose"} ,
new Obj{Id = 3, Name = "Jose"} ,
new Obj{Id = 4, Name = "Jose"}

}
;
return objs;
}
}

and then, on an aspx page, i have this:

<asp:ScriptManager runat="server" ID="manager" />
<asp:UpdatePanel runat="server" ID="panel">
<contenttemplate>
<asp:GridView ID="GridView1" runat="server"
PageSize="2"
DataSourceID="source" AllowPaging="true">
</asp:GridView>

<asp:ObjectDataSource
TypeName="ObjDs"
SelectMethod="Get"
ID="source" runat="server">
</asp:ObjectDataSource>
<%= DateTime.Now.ToString() %>
</contenttemplate>
</asp:UpdatePanel>

it's working here. does it work there?


Hi LuisThanks for the reply.I am using a database queried created dataset and not a custom dataset,does this make a difference?What gets me is that after the page has loaded for a first time the paging works and after a partial postback the rest of the controls workexcept the datagrid's paging.

I'll have a crack at your code and let you know.


Hi Dexza,

Here is a working sample which is written based on your description. Please compare it with yours.

<%@. Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<script runat="server"
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.DropDownList1.Items.Add("111");
this.DropDownList1.Items.Add("222");
}
}

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{

}
</script
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<%=DateTime.Now.ToString()%>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" PageSize="2" AllowPaging="true">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="EmployeeID" HeaderText="EmployeeID" InsertVisible="False"
ReadOnly="True" SortExpression="EmployeeID" />
<asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
<asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NORTHWNDConnectionString%>"
SelectCommand="SELECT [EmployeeID], [LastName], [FirstName], [Title] FROM [Employees]"
DeleteCommand="DELETE FROM [Employees] WHERE [EmployeeID] = @.EmployeeID" InsertCommand="INSERT INTO [Employees] ([LastName], [FirstName], [Title]) VALUES (@.LastName, @.FirstName, @.Title)"
UpdateCommand="UPDATE [Employees] SET [LastName] = @.LastName, [FirstName] = @.FirstName, [Title] = @.Title WHERE [EmployeeID] = @.EmployeeID">
<DeleteParameters>
<asp:Parameter Name="EmployeeID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="LastName" Type="String" />
<asp:Parameter Name="FirstName" Type="String" />
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="EmployeeID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="LastName" Type="String" />
<asp:Parameter Name="FirstName" Type="String" />
<asp:Parameter Name="Title" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" AutoPostBack="true">
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</form>
</body>
</html>

Best regards,

Jonathan


Hello.

Jonathan, i haven't run the code, but i'm curious: why did you associate a trigger with a server control that is inside an updatepanel?


Hi Luis Abreu,

Thanks for your attention. I just generated a sample based on the description of the thread owner. Yes , I agree with you that we don't need a trigger in this situation. Thanks

Best regards,

Jonathan


hello again.

well, i just asked because i might be missing something...thanks for the clarification.


Hi guys I have found my problem regarding the paging issue fromContributor post I noticed that on his properties he had only AllowPaging set to true and I had AllowPaging and EnablePagingAndSortingCallback set to true. So I changed it to false and of we go. Paging and sorting is up and running. Now I still have the problem where after selecting something different from my dorpdownlist that the updating does not work, but if I go back to the data the page was loaded with it works fine. So I have two questions. Why does the paging and sorting stop to function with a partial postback if EnablePagingAndSortingCallback is set to true. And what is wrong with the update function. Here is my code.

<%@.PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default"%> <%@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1"%> <!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"> <title>Untitled Page</title> <linkhref="StyleSheet.css"rel="stylesheet"type="text/css"/></head> <body> <formid="form1"runat="server"> <asp:ScriptManagerID="ScriptManager1"runat="server"/> <br/> <br/> <br/> <br/> <asp:PanelID="Panel2"runat="server"BorderColor="Silver"BorderStyle="Solid"BorderWidth="1px" Height="50px"Width="125px"> <asp:UpdatePanelID="UpdatePanel1"runat="server"EnableViewState="False"UpdateMode="Conditional"> <ContentTemplate> <asp:GridViewID="GridView1"runat="server"AllowPaging="True" AutoGenerateColumns="False"BackColor="SteelBlue"DataKeyNames="IdeaNumber"DataSourceID="ObjectDataSource1"ForeColor="White"GridLines="None"Width="504px"AllowSorting="True"> <Columns> <asp:CommandFieldShowEditButton="True"/> <asp:BoundFieldDataField="IdeaNumber"HeaderText="IdeaNumber"InsertVisible="False" ReadOnly="True"SortExpression="IdeaNumber"/> <asp:BoundFieldDataField="IdeaName"HeaderText="IdeaName"SortExpression="IdeaName"/> <asp:CheckBoxFieldDataField="IdealDone"HeaderText="IdealDone"SortExpression="IdealDone"/> </Columns> <AlternatingRowStyleBackColor="LightBlue"ForeColor="SteelBlue"/> </asp:GridView> <asp:ObjectDataSourceID="ObjectDataSource1"runat="server"DeleteMethod="Delete" EnableViewState="False"InsertMethod="Insert"OldValuesParameterFormatString="original_{0}" SelectMethod="GetIdeaData"TypeName="IdeaDataSetTableAdapters.IdeaTableTableAdapter" UpdateMethod="Update"> <DeleteParameters> <asp:ParameterName="Original_IdeaNumber"Type="Int32"/> </DeleteParameters> <UpdateParameters> <asp:ParameterName="IdeaName"Type="String"/> <asp:ParameterName="IdealDone"Type="Boolean"/> <asp:ParameterName="Original_IdeaNumber"Type="Int32"/> </UpdateParameters> <SelectParameters> <asp:ControlParameterControlID="DropDownList1"Name="IsDone"PropertyName="SelectedValue" Type="Boolean"/> </SelectParameters> <InsertParameters> <asp:ParameterName="IdeaName"Type="String"/> <asp:ParameterName="IdealDone"Type="Boolean"/> </InsertParameters> </asp:ObjectDataSource> <asp:DropDownListID="DropDownList1"runat="server"AutoPostBack="True"> <asp:ListItemValue="false">To do</asp:ListItem> <asp:ListItemValue="true">Completed</asp:ListItem> </asp:DropDownList> </ContentTemplate> <Triggers> <asp:AsyncPostBackTriggerControlID="GridView1"EventName="RowEditing"/> </Triggers> </asp:UpdatePanel> </asp:Panel> <br/> <br/> </form></body>

</html>


hello.

well, not sure on what's happening there...anyways, i'll just leave my 2 cents. first, if you have an updatepanel, i'm not sure if you'll be wining much with the grid's paging and sorting through callbakcs (if you have the time, compare the size of each request - yeah, i believe that through callbacks you'll have less to transport but you can't do other interesting things).

second, i can't seem to think of a good reason why the callback mechanism should not working with the updatepanel partial postbacks. try using fiddler to see what's happening between client and server...

Wednesday, March 21, 2012

partial postback and FireFox

in FireFox, using javascript to call parent.__doPostback('mycontrol') seems to initiate the partial postback on the parent window, and you can see the UpdateProgress rotating Image, but it does not go away and the page never refreshes.

This works fine on IE and Opera - is this a known FireFox issue that the atlas team is working on?

Thanks in advance

hello.

any chance on providing a demo page that reproduces this problem?


Thanks for the reply Luis... unfortunately I don't have a demo page at hand, but will try to put one together if no-one else is already familiar with this particular issue.


hello.

well, you could also use fiddler to see what's getting passed from client to server and vice-versa...


FYI, this seems to have resolved itself with Beta 2

Correction, this still is not resolved - I was under the impression that it was fixed because calling __doPostBack with an eventtarget parameter that does not exist is causing a regular postback (a change from CTP)... you still cannot call __doPostBack() in hopes for a partial postback in FireFox.


I am having a similar problem as well. However i am initiating the partial page postback through a pop-up window. The pop-up window calls window.opener.__doPostBack(target, argument). The postback actually gets executed on the server, but the UpdatePanel on the underlying page does not get updated on FireFox. This works fine on IE.

Here is the source of a very simple page.

ASPX Page

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="sm1" runat="server" />
<asp:UpdatePanel id="updater" runat="server">
<ContentTemplate>
<asp:Label ID="serverTime" runat="server" /><br />
<asp:Button ID="getTime" Text="Get Server Time" runat="server" UseSubmitBehavior="false" OnClick="getTime_Click" /><br />
<a href="#" onclick="window.open('popupAjax.html','Popup','width=200,height=200');">Open Popup</a>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>

Code Behind

using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;
using System.Threading;

public partialclass UpdatePanel : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
serverTime.Text = DateTime.Now.ToLongTimeString();
}
protected void getTime_Click(object sender, EventArgs e)
{
Thread.Sleep(1000); // Used just to similate processing of something.
serverTime.Text = DateTime.Now.ToLongTimeString();
}
}

Simple Popup Page

<!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>
<title>Untitled Page</title>
</head>
<body>
<a href="#" onclick="window.opener.__doPostBack('getTime','');window.close();">Update And Close Window</a>
</body>
</html>


In the example above I was using the latest ASP.NET AJAX Beta 2 build.

It seems you are having the same issue as I... the work-around we used for FireFox is to simply do a full postback - as follows:

if (opener.document.getElementById("__EVENTTARGET") !=null)

opener.document.getElementById("__EVENTTARGET").value ="XXXXXXXX";

if (opener.document.getElementById("__EVENTARGUMENT") !=null)

opener.document.getElementById("__EVENTARGUMENT").value ="";

opener.document.forms[0].submit();


hstechl:

It seems you are having the same issue as I... the work-around we used for FireFox is to simply do a full postback - as follows:

if (opener.document.getElementById("__EVENTTARGET") !=null)

opener.document.getElementById("__EVENTTARGET").value ="XXXXXXXX";

if (opener.document.getElementById("__EVENTARGUMENT") !=null)

opener.document.getElementById("__EVENTARGUMENT").value ="";

opener.document.forms[0].submit();

Where do you put this script ? In a client script block or ?


I would try the followings:

- I have problems in firefox 2.0 and ajax ctp/beta 1/beta 2 (rc1 not tested yet) when opening popups via javascript (strange javascipt errors, i have athread about it, but no response yet)

so instead of

<a href="#" onclick="window.open('popupAjax.html','Popup','width=200,height=200');">Open Popup</a>

try

<a target="_blank" href="popupAjax.html">Open Popup</a>

(I think this is better for the "modern" browsers, because you not force your user for a defined window size and the user could decide where to place our popups: in a new window?, in a new tab? However there is one drawback: you cannot close the popup by javascript without a security warningSmile )

- Maybe thedummy button trick is works for you (I am using it for ajax popups and parent update panels always). Not elegant but works.

Partial Postback + Extenders (Blast from the Past...)

This seems rather ironic with the issues concerning the extenders after partial postbacks in the newest release. At work, we are still using the CTP release and have not converted to Beta. I am also having problems with my extenders not working after a partial postback. The current page uses 2 main controls. One is a custom control that contains a textbox, calendar, and popup behavior to encapsulate a popup calendar. The other is a custom autocomplete extender. The javascript events are not being fired. (I've verified this by adding debug statements in the javascript that print out if I remove the UpdatePanel, and do not print out when the UpdatePanel is uncommented.

MasterPage's ContentTemplate
--UpdatePanel
--table
--tr
---td
----DetailsView
----Row
-----PopupCalendar Control
----Row
-----Custom AutoComplete
----GridView

I saw one post saying that it was the table causing the problem and that making the table runat="server" fixed his/her problem. Lucky him/her. If the DetailsView uses DefaultMode="edit", then both controls work. If I start in ReadOnly mode and use a partial postback to switch...no-go.

I know that this is an older release, but if anyone has any thoughts or experienced this when they were using the last pre-beta CTP release, I'd really appreciate some help before I rip all of my hair out.

Thanks.

I suspect the problem here is that the UpdatePanel doesn't understand the dynamic loading of the components, which probabaly happens in PreRender after the UpdatePanel has scanned the tree. So when the DetailsView switches modes and popuplates itself, it's too late. Unfortuantely, I'm not sure how to fix it.

One thing you can try is calling DetailsView1.DataBind() in Page_Load.


I had a similar problem with the AccordionExtender in an UpdatePanel and created the following workaround:

1) Get control toolkit source code

2) Add the following class under AjaxControlToolkit\ExtenderBase\ExtendedScriptBehaviorDescriptor.cs:

using System;using System.Collections.Generic;using System.Text;using Microsoft.Web.UI;namespace AjaxControlToolkit.ExtenderBase{/// <summary> /// This is merely a hack to overcome the known limitation of the Ajax 1.0 Beta 2 /// that it is impossible to use control extenders inside UpdatePanel because /// the correspondend Behavior instance is being lost after the async postback. /// The workaround is to register an event handler on page load event of the /// PageRequestManager and to re-create the behaviour in this event handler. /// This class has been only tested for an Accordion control inside UpdatePanel. /// </summary>class ExtendedScriptBehaviorDescriptor: ScriptBehaviorDescriptor {public ExtendedScriptBehaviorDescriptor(string type,string elementID):base(type, elementID) { }protected override string GetScript() {string answer =base.GetScript() +" Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded("+"function (sender, args) {"+" var myBehaviors = Sys.UI.Behavior.getBehaviorsByType($get('" +this.ElementID +"'), " +this.Type +");" +" if(myBehaviors.length == 0) {"+base.GetScript() +" }"+"});";//Known limitation / bug: if you register several extenders of the same type //for the same DOM element, only one of them (anyone) will be re-created //after async postback. Can be easily fixed using a slightly more complex //checking logic in the javascript above.return answer; } }}

3) Find the method GetScriptDescriptors in ExtenderControlBase and change the following:

//Original code (before patch): //ScriptBehaviorDescriptor descriptor = // new ScriptBehaviorDescriptor(ClientControlType, targetControl.ClientID); ExtendedScriptBehaviorDescriptor descriptor =new ExtendedScriptBehaviorDescriptor(ClientControlType, targetControl.ClientID);

4) Compile the control toolkit, reference the new version in your project and try if it works now.

You can use the new class also with extenders not using ExtenderControlBase from the Control Toolkit.


Neat! I've openedwork item 6063 to track this.

Sorry for the delay in replying, I ditched college for the week and went home for Thanksgiving.Wink. Calling DataBind on the DetailsView in the PageLoad event didn't work. Random thought: to match other pages in the project, both the details view and gridview are in the same update panel. I wonder if separating so that the dv and gv each have their own update panel would make a difference.

*starts muttering and switches back to VS.

Edit: If I use DefaultMode="Edit" for the DetailsView, click in the textbox to bring up the popup calendar, and click to advance the month, I get the following:

Alert


In the pre-beta CTP, there is no ScriptBehaviorDescriptor, so if this is even a possible hack, it will need to be a hack of a hack. Is there a CTP equivalent?


We recommend using the latest Beta. There may be issues that would require more investigation using the ctp. A lot of changes were made just to get the toolkit working at the asp.net ajax beta so it would be best to move to the beta and then pursue this investigation.

Partial Postback looks like Full Postback

Hello,

my page has some databound controls (gridview, detailsview) and some ajax controls (dropdownextender, modalpopup) and everything works quite normal. On postback, my page renders partially showing a nice updateprogress-box.

But when i place a simple asp:DropDown into the contenttemplate of my updatepanel, everything dissapears on postback, and it seems that the browser is rendering the whole page.

I was not successfull to reproduce this behaviour with a little testpage, and i wont trouble you with posting the whole code. Anyway, i hope anyone can help me to solve this.

Thanks!
Holger

Hello Holger,

I am too facing this problem. Some time my page is full post back and some time not.
But every time it disappers the dropdowm and show it again .

Did you solve the problem.

Thanks,
Deepesh

Partial postback in IE7 and Firefox but full postback in IE6

I have a peculiar problem with ajax page not working the same way on IE6 (service pack 2) and on IE7 and Firefox…

IE7 and Firefox works perfectly and I have no complains but whenever I tried to run the page from other computers on the network (with IE6.0) the edit controls and listboxes blink when there is a partial postback which led me to suspect that maybe there is a problem with the java script and full postback is being performed.

I have not posted the code for the page because it's rather generic. I have Tab Control from ajaxtoolkit on the top of the page that switches panes with various edit boxes and list boxes and other common controls. And there is also a timer control within the update panel that triggers updates once a while (10s).

One last thing to note is that I have a listbox tool tip feature done in javascript that is also not displaying right or should I say at all except for some weird stuff sort of showing on the screen - a white outline of sorts of the tooltip. And this is all for IE6.0. Firefox is also not displaying the tooltip but that's not conerns the project since it is directed to work under IE.

Like I said IE7 (and somewhat Firefox) work perfectly…

Any help is appreciated.

Thanks,

Arek

I guess you're just experiencing typical IE6 flickering. If you have "Check for newer versions of stored pages" set to "every visit" you should set it to something else. The problem may still be there though.

partial postback doing full postback - bug in ATLAS ?

theres no rhyme or reason, but my partial postback button often does full postbacks and then reverts to partial postbacks for no apparent reason...

I can't find anything on this and was suggested that this is a bug in the current release of ATLAS. Does anyone have any idea on this ?

I'm bashing my head trying to figure this one out ..


Thanks very much

mike123

hello.

well, that is strange. do you have a simple demo page that reproduces this?


I'm sorry I don't have one at this time ... =[ I could get it online if you think its crucial to see it to help diagnose

any ideas ?

thanks very much


well, we have to see the server side code to help you diagnoise. an online sample doesn't give us that.


The actual code doesnt really show too much but here it is anyways

I'm really lost on where to go from here. Anyone have any ideas ? I was so psyched about using ATLAS but it's pretty frustrating not being able to get past this point.

Thanks again,

mike123

<formid="form1"runat="server">

<asp:TextBoxId="textbox1"runat="server"/>

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

<divstyle="background-color: Yellow; float: left; width: 100px;">

<asp:LabelID="FullPostBackLabel"runat="server"/><br/>

<asp:ButtonID="FullPostBackButton"runat="server"text="Full Post Back"OnClick="FullPostBackButton_OnClick"/>

</div>

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

<ContentTemplate>

<divstyle="background-color: Lime; width: 100px;">

<asp:LabelID="PartialPostBackLabel"runat="server"/><br/>

<asp:ButtonID="PartialPostBackButton"runat="server"text="Partial Post Back"OnClick="PartialPostBackButton_OnClick"/>

</div>

</ContentTemplate>

</atlas:UpdatePanel>

<atlas:UpdateProgressID="UpdateProgress1"runat="server">

<ProgressTemplate>

Please wait... </ProgressTemplate>

</atlas:UpdateProgress>

</form>

PublicSub FullPostBackButton_OnClick(ByVal senderAsObject,ByVal eAs EventArgs)

FullPostBackLabel.Text = DateTime.Now.ToString()

EndSub

PublicSub PartialPostBackButton_OnClick(ByVal senderAsObject,ByVal eAs EventArgs)

PartialPostBackLabel.Text = DateTime.Now.ToString() &"Partial"

EndSub


hello.

this is weird. i tried running your page in an empty atlas site and it worked without anyproblems...have you tried running this page in a site created through the atlas template?


No I haven't as this is a pretty large web application that needs to have atlas running on it. I don't think theres a problem with the code either, something to do with integration but no idea where to start. I've tried things such as removing flash from the page and javascript ads.... Still no luck ....

Any ideas?

Thanks very much

mike123


I had a similar problem then I found that it was related to custom javascript code that was calling __dopostback


I had a smiliar problem too. I found that It didnt like my hidden input.

<input type="hidden" name="action" ID="action" value="" />

Once i deleted that everything was fine!


I found out that when removing the following line

<xhtmlConformance mode="Legacy"/>

from web.config , UpdatePanels work like they should

this did not occur in Atlas CTPs, but in AJAX final release...

Partial Postback Does not Register Client Startup Script

When we do a full postback, the page's client script registers a startup script like the one below, however, on a partial postback the script is not registered. Since the script is not registered, our calendars fail to initialize and are not usable. Any help would be appreciated. Thanks!

string StartCalendarJS ="var calStart0 = new js_calendar(document.getElementById('" + StartDateTextBox.ClientID +"'));";

StartCalendarJS +=

"calStart0.year_scroll = true;";

StartCalendarJS +=

"calStart0.time_comp = false;";

cs.RegisterStartupScript(cs.GetType(),

"CsStartDate", StartCalendarJS,true);

StartDateCal.Attributes.Add(

"onclick","javascript:calStart0.popup();");

StartDateCal.Attributes.Add(

"onMouseOver","this.style.cursor='hand';");I would also like to share that the code above is being executed during the DataBound function of a gridview which includes the calendar we are trying to implement. Thanks.

Try,

System.Web.UI.ScriptManager.RegisterClientScriptBlock(.........);

Aeries


That also does not execute the js.

Any answer to this yet? Perhaps this is fixed in the latest version? We are using the Nov. 2006 release.

Any information would be great.

Thanks

partial postback does not occur but the whole page gets reloaded


Hello coders,

I got a problem with my updatepanel.
I have a dynamic datagrid with a delete button. When i press the delete button
the partial postback occurs. ALL THIS WORKS FINE.

However i also have a Textbox in the same datagrid.
When i change the value in the Textbox a callback is generated.
The partial postback does not occur but the whole page gets reloaded.
This is not what i want.

So what is the diference between these two?

I will post a simplified version of my code:

'------<asp:UpdatePanel ID="udpWinkelwagen" runat="server"> <ContentTemplate> <asp:PlaceHolder ID="phWinkelwagen" runat="server" ></asp:PlaceHolder> </ContentTemplate></asp:UpdatePanel>'------ dgWinkelwagen =New DataGrid dgWinkelwagen.AutoGenerateColumns =False dgWinkelwagen.ShowFooter =True dgWinkelwagen.DataSource = ds.Tables(0) ...'TextField tempCol =New TemplateColumn tempCol.HeaderText = myDB.LeesVeld(myDB.haalViewOp("web_WinkelwagenText","quantity", taal),"Text") tempCol.ItemTemplate =New DynamicItemTemplateTextBox(Me.Page, bestelnr, taal) dgWinkelwagen.Columns.Add(tempCol)'delete button strConrirm = myDB.LeesVeld(myDB.haalViewOp("web_WinkelwagenText","confirmDelete", taal),"omschrijving") tempCol =New TemplateColumn tempCol.ItemStyle.HorizontalAlign = HorizontalAlign.Center tempCol.HeaderText ="" tempCol.ItemTemplate =New DynamicItemTemplateDeleteButton(bestelnr, strConrirm,Me.Page) dgWinkelwagen.Columns.Add(tempCol) dgWinkelwagen.DataBind()' add to placeholder on page phWinkelwagen.Controls.Add(dgWinkelwagen)'------Public Class DynamicItemTemplateTextBoxImplements ITemplateDim ds, dsProcAs DataSetDim myDBAs DB =New DBDim myHulpAs HulpFuncties =New HulpFunctiesDim myOrbisAs OrbisTaskCentre =New OrbisTaskCentreDim myWebshopAs webshopFuncties =New webshopFunctiesDim taalAs String Dim btnSave, txtSave, strAlert, titel, omschrijvingAs String Dim artikel, bestelnr, errorTextAs String Dim myPageAs PageDim aantalAs Double Sub New(ByVal pAs Page,ByVal bestnrAs String,ByVal taalcodeAs String) myPage = p bestelnr = bestnr taal = taalcodeEnd Sub Public Sub InstantiateIn(ByVal containerAs Control)Implements ITemplate.InstantiateInDim txtAantalAs TextBox =New TextBox() txtAantal.AutoPostBack =True txtAantal.Width ="38" txtAantal.MaxLength ="4"AddHandler txtAantal.TextChanged,AddressOf Me.changeValue container.Controls.Add(txtAantal)End Sub Public Sub changeValue(ByVal senderAs Object,ByVal eAs EventArgs)CType(myPage.Master, masterMethods).updateCart()CType(myPage.Page, winkelwagenMethods).updateGrid()End SubEnd Class'------Public Class DynamicItemTemplateDeleteButtonImplements ITemplateDim artnr, txtAantal, btnDelete, strConfirm, omschrijving, strAlertAs String Dim myDbAs DB =New DBDim dsProcAs DataSetDim bestelnrAs Integer Dim mypageAs PageSub New(ByVal _bestelnrAs Integer,ByVal confirmAs String,ByVal _pageAs Page) strConfirm = confirm bestelnr = _bestelnr mypage = _pageEnd Sub Public Sub InstantiateIn(ByVal containerAs Control)Implements ITemplate.InstantiateInDim imgBtnDelAs ImageButton =New ImageButton() imgBtnDel.ImageUrl ="~/images/remove.gif"AddHandler imgBtnDel.Click,AddressOf Me.DeleteArtikel container.Controls.Add(imgBtnDel)End Sub Public Sub DeleteArtikel(ByVal senderAs Object,ByVal eAs ImageClickEventArgs) artnr =CType(CType(sender, ImageButton).Parent.Parent.Controls(1).Controls(0), Label).TextDim parameters1()As String = {bestelnr, artnr} dsProc = myDb.startProcedure("web_winkelwagen_artikel_delete", parameters1)CType(mypage.Master, masterMethods).updateCart()CType(mypage.Page, winkelwagenMethods).updateGrid()End SubEnd Class

hello.

can you builkd a simple demo page that reproduces the app and put it here so that we can simply copy/paste it into vs?