Showing posts with label update. Show all posts
Showing posts with label update. Show all posts

Wednesday, March 28, 2012

Page with update panel doesnt show correct information when I back into the page

I have this page that I'd like to use update panels on. There are three controls on the page. I'd like to have the first dropdown control fire a second dropdown and then that one fire a gridview. I'd like the 2nd dropdown and the gridview to be in update panels. So when a user makes a general category selection in the first dropdown, the 2nd one will list the more specific categories (those related to the first dropdown selection) and then when the user picks a more specific category the gridview is filled with with data specific to that 2nd more specific category. I've got this all working fine. The the user clicks the "details" link in the gridview and they see full details about their selection from the gridview. But then when they click the "back" button in their browser, it takes them back to the page with the 2 dropdowns and the gridview but it's not in the state they left it. Ideally, they should see the same thing they saw before they clicked the "details" link.... their first selection int he first dropdown, their more specific category in the 2nd dropdown and the gridview filled with info relating to that 2nd dropdown. But that's not what I get. What am I missing?

hello.

well, you're not missing anything. it's simply the way ajax pages work. i think that you should take a look at the history control available on the future bits

http://msmvps.com/blogs/luisabreu/archive/2007/05/07/may-future-bits-the-history-control.aspx

Page_Load always executed - can this be changed?

Hello,

I started using <asp:UpdatePanel> to update controls content in my page.

This work really great, and the Look and Feel are perfect.

However, in the page I load many controls dynamically in the Page_Load - it can reach thousands of controls.

Each of the controls contains UpdatePanel that has UpdateMode of "Conditional" - this let me change the contents of each control without affecting the other controls.But, and here finally come the catch, I noticed the whole Page_Load is executed. When there will be thousands of controls, I would like to Load them only once, then have AJAX code that would not cause the whole Page_Load to run again.

Is this possible? Can we make the AJAX read other page maybe?

Thanks in advance. :)

If you want to only run the code on the initial Page Load, you can throw everything in if(!Page.IsPostBack && !Page.IsCallBack). We use that method for most stuff, but if you use 3rd party controls, there may be some issues... We use telerik controls and they do a post back like event, which isn't caught by that.

Well, if I add if (!Page.IsPostBack) then the controls are lost, as they're not static in the page but rather created on the fly using Page.LoadControl method.

What I'm trying to achieve is that different page will be called by the AJAX "engine". So far my investigations on this bore no fruit. Any ideas?

Paged GridView in update panel doesnt work

Hi, I have paged grid view inside an update panel but when I try to change the page in the grid view nothing happens, any ideas why? thanks for your help.

Could you post your code so we can see exactly what you are doing?


Yes, here is the gridviewcode

<asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="1" AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging" PageSize="12" AutoGenerateColumns="False">
<FooterStyle BackColor="White" ForeColor="#000066" />
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:BoundField DataField="# Cuota" HeaderText="# Cuota" />
<asp:BoundField DataField="Saldo Inicial" HeaderText="Saldo Inicial" />
<asp:BoundField DataField="MontoInteres" HeaderText="Monto Interes" DataFormatString="{0:C}" HtmlEncode="False" />
<asp:BoundField DataField="Monto Cuota" HeaderText="Monto Cuota" />
<asp:BoundField DataField="MontoCapital" HeaderText="Monto Capital" DataFormatString="{0:C}" HtmlEncode="False" />
</Columns>
</asp:GridView>

The grid view gets filled with data, it just wont let me browse through the grid view pages and it works outside the update panel.


Nevermind, outside the update panel it just postbacks but I hadnt notice the information is the same. I dont have any eventhandler set on the gridview.


I made it work. I just added this code


protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{

GridView1.DataSource = ViewState["DataTable"] as DataTable ;
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataBind();
}

Thanks for your help.

Monday, March 26, 2012

PageMethods vs UpdatePanel

Hi,

I am a big fan of using 'Update Panels'. Not because of the only simplicity but also bcoz of my belief on the AJAX framework.

Also Scott G has kept on introdcueicng lots of new features in UpdatePanel in Orcas/S 2008


But,still lots of architects do say that, PageMethods[http://metasapiens.com/PageMethods/Tutorial/VS2005/] are moreefficient than Update Panels.
Here is the link - ASP.NET AJAX UpdatePanels are dangerous.

http://encosia.com/2007/07/11/why-aspnet-ajax-updatepanels-are-dangerous/

Afterreading the page, I am quite suspicious on Update Panel and now thinkthat really PageMethods saves perfomance overhead.But at the same time,simply by going thru few pages, accepting the same seems to be quiteimpractical.

Please let me know, is really PageMethods are moreefficient than UpdatePanel. If yes, then please list me the things thatcannot be done using PageMethods, which can be done by UpdatePanel.

Regards,

Arun

take a look at the video byJoe Stagner

How Do I: Choose Between Methods of AJAX Page Updates?

http://www.asp.net/learn/ajax-videos/video-160.aspx

It will show you the big diference...

And the response by the WebMethod, give you the freedom to manipulate and interact with the HTML elements (UI) way you want ..

PageRequestManager updatePanelIds issue

Hi,

I'm trying to use and update panel on a page that uses a master page. I've noticed that the uniquePanelId's in the pageRequestManager xml-script are separated by ":" not by "$". Because of this atlas is not finding my update panel.

1. Is there a setting I'm missing that determines what the separator is?

2. If not the above is there a way to modify the atlas.js function uniqueIdtoClientId to include the ":" character? right now the code is:

function uniqueIDToClientID(uniqueID) {return uniqueID.replace(/\$/g,'_');

}

3. Or any other suggestions.

This only seems to happen when I use a master page.

Has anyone ever come up for a soluation to this problem?

I'm running into it with an update panel being on a user control.

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.

PageRequestManagerParserErrorException with the Update Panel

I have spent quite a bit of time researching this and I cannot figure it out. So if there is anybody that has any ideas I am all ears.

I have a pretty simple site that uses a few update panels. I am developing with VS2005 on XP all the patches and using ASP.NET AJAX 1.0. Everything works perfect on my dev machine and on second beta server I have. When everything get moved to the client site they get the "PageRequestManagerParserErrorException" error on the pages with the update panel. I am not using server.transfer or respnse.write() or any other known issues. The client machine is a test box that was imaged for this app. Running Win2003 all clean and up to date in a pretty standard configuration.

I am just looking for direction: I saw some posts about response caching and machinekey but I have no idea what to look for or what to direct the sys admin to look for.

Any help would be greatly appreciated.

Craig.

Have a look here for troubleshooting tips:http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx

Also see this related post:http://forums.asp.net/p/1038252/1439637.aspx

Hope these help...

-Damien


Damien,

Thanks for the links. In my searching I did come accross them (and meany others). So I threw up a server outside of my network that and tried to hit the pages with an update panel again. And this time I get the error (sometimes). It was strange that I would sometimes get an error and others I wouldn't. So I installed fiddler to see what the response was like. When I get an error I notice this in the respose;

[HttpException (0x80004005): Server cannot modify cookies after HTTP headers have been sent.]
System.Web.HttpCookieCollection.Add(HttpCookie cookie) +103
System.Web.Security.RoleManagerModule.OnLeave(Object source, EventArgs eventArgs) +650
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

I am using a master page that will show differnt information based on the user's role. My guess is that the injection of this error into the response is causing the problem because when it works there is no error. Unfortunatly I don't know what this means yetHmm. Guess it's back to the internet for some studying.

If anybody has any sugestions or direction on addressing this issue I would welcome the advice.

Regards,

Craig


Got it!Big Smile

This link was the answerhttp://forums.asp.net/p/1069056/1556225.aspx#1556225

I still need to read up on the issue but the answer was to set the cacheRolesInCookie=false in the web.config file. Made the change and all is good. Although, I now wonder what the impact is now on perfomance.

Craig

PageRequestManagerParserErrorException with the New ASP.Net Ajax framework

I have two simple web pages with two update panels in them. The first one calls the second one using Server.Tranfer or Server.Execute and it gives the following error message:

Sys.WebForms.PageRequestmanagerParsererrorException: The Message received from the Server could not be Parsed. Common caused for this error are when the response is modified by calls to response.Write(), response filters, HttpModules, or server trace is enabled.

Now, this never happened with the previous framework, atlas. I've tried all possible solutions I could think of, but none worked so far.

Try to take a look at the following forums for?reference.
http://forums.asp.net/thread/1467462.aspx
Wish this can help you.

Saturday, March 24, 2012

PageRequestManagerServerErrorException with 500 error code

In javascript I'm setting the value property of a button within an update panel before calling click() on the button to refresh the update panel. (I need to refresh an update panel and pass extra data on the callback, and no one on this forum has yet described a better way of doing it than this.)

This was all working in tests that I did last week, but I'm now getting the following error message box in IE:

"Sys.WebForms.PageRequestManagerServerErrorException: An unkown error ocurred while processing the request on the server. The status code returned from the server was: 500"

Any ideas?

I have the same error but on a couple of dropdown which update one another's datesource with updatePanels.

If i change the value of the first dropdown for several times, always the third tine gives this error.

I found on a post the setting TRACE off resolves but not for me.

Any ideas ?

Just try to change frequently some controls which use updatepanels (for other controls) and see what's happen.

Thank's

Sorin


I found also that If I have more than 3 UpdatePanels in a Page I get this error after 3 callbacks.

If I have on page Trace="false"and "EnableEventValidation="true"

I get this error:

Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@. Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

Thank's again


I've also tried setting the value of a hidden field and a hidden textbox and both raise the same error.

I cannot even paste data into a textbox and then do a postback without getting this error.

I'm also EXTREMELY TIRED OF MICROSOFT IGNORING ALL OF MY POSTS!!!!!!!!!!! Angry

Paging and UpdatePanel

Hi,

If you look at this page you see an example of paging within an update panel which works well

http://mattberseth2.com/resizeable_gridview_columns/


The difference I have is I also have ajaxToolkit:HoverMenuExtender on my first column which popups 'Edit Details' text which takes you to a new page...

without any triggers on the updatepanel, my paging now works as the above example.. but when I use my hover menu and click on 'Edit Detail' I get the following error..


Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing near '

to fix this error I use the following trigger on the updatepanel

<Triggers>
<asp:PostBackTrigger ControlID="GridView1" />
</Triggers>

now when I click on Edit Details it takes me to the new page as intended... but when I click on my paging buttons it doesnt work within the update panel it causes full page reload..

any ideas to get these two working together would be appreciated...


I have newver try that, I actually just added the GridView inside an UpdatePanel and seem to work really well


Hi,

Generally, I think implement it as Albert suggested should work.

If still not, please provide a simple repro that demonstrate the first problem(Sys.WebForms.PageRequestManagerParserErrorException: The messagereceived from the server could not be parsed. Common causes for thiserror are when the response is modified by calls to Response.Write(),response filters, HttpModules, or server trace is enabled. Details:Error parsing near ' ).


Hi,

simple repro.. would be to grab the example from the above link... and add following hovermenu to first column... add pagertemplate below...

paging works fine within the updatepanel

on clicking edit details you get the error as described in the first post...

to fix this error I use the following trigger on the updatepanel

<Triggers>
<asp:PostBackTrigger ControlID="GridView1" />
</Triggers>

but now the paging causes full page post back..

adding thelnkBtnRowEditDetail as a trigger as well dosent work as that gives a control id cant be found error.

 <asp:TemplateField ShowHeader="False"> <ItemTemplate> <asp:Panel CssClass="popupMenu" ID="PopupMenuCustomerName" runat="server"> <div class="popupMenuButtons"> <asp:LinkButton ID="lnkBtnRowEdit" SkinID="SmallTextPopUp" runat="server" CommandName="Edit" Text="Edit
</asp:LinkButton> <asp:LinkButton ID="lnkBtnRowEditDetail" SkinID="SmallTextPopUp" runat="server" CommandName="EditDetail" Text="Edit Detail"></asp:LinkButton> </div> </asp:Panel> <asp:Panel ID="PanelCustomerName" runat="server"> <asp:ImageButton ID="ImgButton" runat="server" AlternateText="Edit" ImageUrl="~/images/icon_edit.gif" CausesValidation="false" CommandName="" /> </asp:Panel> <ajaxToolkit:HoverMenuExtender ID="hme3" runat="Server" HoverCssClass="popupHover" PopupControlID="PopupMenuCustomerName" PopupPosition="Left" TargetControlID="PanelCustomerName" PopDelay="15"> </ajaxToolkit:HoverMenuExtender> </ItemTemplate> <EditItemTemplate> <asp:Panel CssClass="popupMenu" ID="PopupMenuCustomerName" runat="server"> <div class="popupMenuButtons"> <asp:LinkButton ID="lnkBtnRowUpdate" SkinID="SmallTextPopUp" runat="server" CommandName="Update" Text="Update"></asp:LinkButton><br /> <asp:LinkButton ID="lnkBtnRowCancel" SkinID="SmallTextPopUp" runat="server" CommandName="Cancel" Text="Cancel"></asp:LinkButton> </div> </asp:Panel> <asp:Panel ID="PanelCustomerName" runat="server"> <asp:ImageButton ID="ImgButton" runat="server" AlternateText="Update/Cancel" ImageUrl="~/images/icon_edit.gif" CausesValidation="false" CommandName="" /> </asp:Panel> <ajaxToolkit:HoverMenuExtender ID="hme3" runat="Server" HoverCssClass="popupHover" PopupControlID="PopupMenuCustomerName" PopupPosition="Left" TargetControlID="PanelCustomerName" PopDelay="15"> </ajaxToolkit:HoverMenuExtender> </EditItemTemplate> </asp:TemplateField>

 <PagerTemplate> <div class="item"> <div class="item_left"> <asp:Label ID="lblPageTxt" runat="server" SkinID="PageSmallText" EnableViewState="false" Text="Page" ></asp:Label> <asp:DropDownList ID="PageDropDownList" runat="server" AutoPostBack="true" OnSelectedIndexChanged="PageDropDownList_SelectedIndexChanged" /> <asp:Label ID="lblOfTxt" runat="server" SkinID="PageSmallText" EnableViewState="false" Text="of"></asp:Label> <asp:Label ID="lbTotalPages" runat="server" SkinID="PageSmallText"></asp:Label> </div> <div class="item_right"> <asp:ImageButton ID="imgbtnFirst" runat="server" CommandName="Page" CommandArgument="First" ImageUrl="~/images/arrow_up.gif"></asp:ImageButton> <asp:ImageButton ID="imgbtnPrev" runat="server" CommandName="Page" CommandArgument="Prev" ImageUrl="~/images/arrow_left.gif"></asp:ImageButton> <asp:ImageButton ID="imgbtnNext" runat="server" CommandName="Page" CommandArgument="Next" ImageUrl="~/images/arrow_right.gif"></asp:ImageButton> <asp:ImageButton ID="imgbtnLast" runat="server" CommandName="Page" CommandArgument="Last" ImageUrl="~/images/arrow_down.gif"></asp:ImageButton> </div> <div class="clear"></div> </div> </PagerTemplate>

not using the hovermenu isnt really an option... as this functionality is consistent with the rest of the site... unless you have another idea for reproducing this functionality

first column of our gridviews are a basic icon image... with a hover menu that has 'Edit' which edits gridview inline 'Edit Details' which goes to a new page ... they also have 'Clone' which provides a modal popup and 'Create Link'/'Remove Link' and other such functionlaity... which is available from the gridview using the hovermenu.



Would you mind showing a repro that I can run directly?


Hi Paul

I looked at the example at

http://mattberseth2.com/resizeable_gridview_columns/

and it looks great.
Can you share your code?

Thanks

Shalom


there is example code on that link... http://mattberseth2.com/resizeable_gridview_columns/

Paging in GridView gets Object Expected Error

I have a grid in an update panel that gets databound at runtime (to index server results). I have implemented paging and it works without atlas. As soon as I place that grid in update panel, paging stops working. All I get is a javascript error saying "line 1 :Object Requiered".

I have tried debugging it but on paging, it doesn't event get to the server.

thanks

Hi Biren,

Have you tried this with the April CTP of Atlas that was released earlier this week?

If it's still a problem, can you please provide some more details on your scenario so that we can investigate?

Thanks,

Eilon


I have done it and it works for me. Object required is a pretty generic error just as the "Object reference not set to an..." in .Net. It could be because of wrong syntax in javascript or html that you might have on the page.

If you don't mind pasting the code on the forum please do so we can look at it.


Just tried it and same error.

here is the code:

<%@. Page Language="VB" AutoEventWireup="false" CodeFile="Index.aspx.vb" Inherits="Index" %>

<!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>Search</title>
<link href="http://links.10026.com/?link=Style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<atlas:ScriptManager EnablePartialRendering="true" ID="atlas1" runat="server" EnableViewState="true" />
<form id="frm1" runat="server">

<atlas:UpdateProgress ID="up11" runat="server" >
<ProgressTemplate >
<table>
<tr>
<th style="color:red">Please wait while your serach results are calculated...</th>
</tr>
<tr>
<td>
<img src="http://pics.10026.com/?src=images/spinner.gif" /></td>
</tr>
</table>

</ProgressTemplate>
</atlas:UpdateProgress>
<atlas:UpdatePanel ID="up1" Mode="conditional" runat="server" >
<ContentTemplate >



<table>
<tr>
<th>A word or phrase in the file: </th><td><asp:TextBox ID="txtsearch" runat="server" /></td>
</tr>
<tr>
<th>All or part of filename: </th><td><asp:TextBox ID="txtfilename" runat="server" /></td>
</tr>
<tr>
<th>When was it modified?:</th>
<td>
<asp:DropDownList ID="lstDuration" runat="server">
<asp:ListItem Text="Don't remember" Value="0" />
<asp:ListItem Text="Within the last week" Value="7" />
<asp:ListItem Text="Past Month" Value="30" />
<asp:ListItem Text="Within the past year" Value="365" />
</asp:DropDownList>
</td>
</tr>
<tr>
<td colspan="2"><asp:Button ID="btnSubmit" runat="server" Text="Search" /></td>
</tr>
</table>

<asp:GridView ID="grdResults" runat="server" CellPadding="4" ForeColor="#333333"
GridLines="None" AllowSorting="True" AllowPaging="True" PageSize="2" AutoGenerateColumns="False">
<Columns>
<asp:TemplateField HeaderText="Document Information">
<ItemTemplate>
<p>
<a href="http://links.10026.com/?link=<%# DataBinder.Eval(Container, "DataItem.path")%>">
<%# DataBinder.Eval(Container, "DataItem.Path")%>
</a>
<br />
<i>Last modified:
<%# DataBinder.Eval(Container, "DataItem.Write")%>
</i>
<br />
</p>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<EditRowStyle BackColor="#999999" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>

</ContentTemplate>

</atlas:UpdatePanel>
</form>
</body>
</html>

Code behind:

Partial Class Index
Inherits System.Web.UI.Page

Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click


' Bind DataGrid to the DataSet. DataGrid is the ID for the
' DataGrid control in the HTML section.
Dim source As New DataView(createDS.Tables(0))
grdResults.DataSource = source
grdResults.DataBind()

End Sub
Private Function createDS() As DataSet
Dim cnnOledb As New OleDb.OleDbConnection
Dim strQuery As String

Dim critstr As String = "(contains(filename,'.doc OR .xls OR .ppt OR .asp OR .aspx OR .txt'))"

If txtsearch.Text.Length <> 0 Then
critstr += " AND (contains(contents,'" + condition(txtsearch.Text) + "'))"
End If


strQuery = "Select DocTitle,Filename,VPath,Rank,Characterization,Write,path from SCOPE() where " + critstr + " order by write desc"

Dim connString As String = "Provider=MSIDXS;Data Source='o drive'"

Dim cn As New System.Data.OleDb.OleDbConnection(connString)
Dim cmd As New System.Data.OleDb.OleDbDataAdapter(strQuery, cn)
Dim objDS As New DataSet

cmd.Fill(objDS)

Return objDS
End Function

Function condition(ByVal srchstr As String) As String
Dim arr As String() = srchstr.Split(" ")
For i As Integer = 0 To arr.Length - 1
Dim str1 As String = arr(i)
If str1 <> "AND" And str1 <> "OR" And str1 <> "NOT" Then
arr(i) = "\" + str1 + "\"
End If
Next
Return String.Join(" AND ", arr)
End Function


Sub grdResults_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles grdResults.PageIndexChanging
grdResults.PageIndex = e.NewPageIndex
Dim source As New DataView(createDS.Tables(0))
grdResults.DataSource = source
grdResults.DataBind()

End Sub
End Class


Hi again,

I tried this out and I'm getting the same error. This turns out to be a known bug in the April CTP of Atlas. To work around it, add this code to your Page's Load event handler:

Page.ClientScript.GetPostBackEventReference(this, String.Empty);

Thanks,

Eilon


that works. Thank you. btw ATLAS ROCKS!!

Appears to be an issue in the June CTP too... and if it wasn't for this post, I'd still have the issue.

Thanks guys


Correct, this was not fixed in the June CTP. For now the one line workaround should still be sufficient.

Thanks,

Eilon


In the case of nested UserControls, does this workaround apply? If so, where should the workaround go?

I have a page which contains a UserControl, which in turn contains another UserControl, which contains a GridView wrapped in an UpdatePanel. I tried adding this line to the page's Page_Load and the UserControl's Page_Load, but I get the same generic error:

Line: 10846
Char: 17
Error: Object required
FYI, the offending line appears to be the second one pasted below:

function destroyTree(element, markupContext) {

if (element.nodeType == 1) {


Any ideas?

slp004, can you please give more details as to what you're trying to do? It sounds like other people on this thread have this scenario working so I'm curious what's going on here.

Thanks,
Eilon


I was never able to figure out exactly what the problem was, but by breaking the page up into a number of smaller pages sharing a single master page it started working again. There were just way too many UserControls inside GridView inside FormView inside UserControls inside View areas inside show/hide panels... you get the idea.

I have exactly the same problem - in the same line

 function destroyTree(element, markupContext) {if (element.nodeType == 1) {

My page have three or four levels of nested user controls inside the update panel. The curious thing is the page with the same controls has worked before some change I did - now I am trying to figure it out.


Wow, I figured out the issue.

The error was caused because I have another updatepanel in this page - inside a user control, included in master page. The user control has Visible=false. This scenario causes the error. When I set the user control visibility to true, the error goes off.

The solution is setting the updatepanel (that is inside the user control) mode to Conditional. This solves the problem even if the user control is invisible.

HTH.


I had the same problem and I set all the update panels to conditional and it worked.

Paging using AJAX ASP.NET & DATAGRID

Hi all,

I am facing a problem ofPAGING in ajax with asp.net. I am not able to create paging on my web page. I have used update panel to view the data in datagrid.

I tried paging but its not working. Please suggest a solution to the above problem

Regards, Prem

Hi Prem,

I have a gridview and the Paging (WITHOUT causing postbacks) works just fine!

Did you check if all the callback options on the grid are disabled (enableSortingAndPagingCallbacks = false !!) ?
Then you just need to place it in an updatepanel.

If it still doesn't work, could you make me a (WORKING) demo with your grid which replicates the error/malfunction?

Kind regards,
Wim

Paging(GridView) Inside update Panel

When I enable Paging for a GridView inside a Update Panel for Jan. CTP I get a JavaScript error when I try to page. Is there a work around for this?

Thanks!

Things are working fine with me. I dont know what's the problem in your project.

A.

Panel disappear after manually update

Hi,

Here is my scenerio

<updatepanel1>

<div>

..............

</div>

<mainPanel1>

<updatepanel2>

<panel visible='true'>

<linkbutton id='lbtnSetVisibleUpdatePanel3' />

</panel>

</updatepanel2>

<updatepanel3>

<linkbutton id='lbtnSetVisibleUpdatePanel2' />

</updatepanel3>

<button id='setVisibleMainPanel2' />

</mainPanel1>

<mainPanel2 visible='false'>

<button id='setVisibleMainPanel1' />

</mainPanel2>

</updatePanel1>

When the page first loaded, mainPanel1 & updatePanel2 is visible. mainPanel2 & updatePanel3 is invisible. When I click on the button setVisibleUpdatePanel3, updatePanel3 will be set to visible and updatePanel2 will be set to invisible. It works fine. When I click on setVisibleMainPanel2 which will set visible mainPanel 2, and invisible mainPanel1, it works fine as well. The problem is when I click on button setVisibleMainPanel1 again which will set mainPanel1 visible again, and invisible mainPanel2, the updatePanel3 turn to nothing when I click on setVisiblePanel3. However, updatePanel2 is still there. Is is a problem related to nested update panel? Does anyone have this problem before?

Many thanks!


Have you got any solution ?

If yes please post it...


Hello,

I found that the updatepanel visible property is useless (in complex scenarios) so I have the same experience than yours.

/ Maybe the up visible property should works, only we've made mistakes. I don't know. /

However the solution is easy for me:

- never use the updatepanel visible property

- put a placeholder or a panel control inside each up, and use that control's visible property. Much cleaner and easier to follow what happens when you toggle the placeholders visible property.


Sorry, I am still trying to solve it. Does anyone have the solution?



testerASPNet:

The problem is when I click on button setVisibleMainPanel1 again which will set mainPanel1 visible again, and invisible mainPanel2, the updatePanel3 turn to nothing when I click on setVisiblePanel3. However, updatePanel2 is still there

Normally when you click lbtnSetVisibleUpdatePanel3 (which set visible=true/false on updatepanel3) it will update updatepanel2 only, updatepanel3 won't rendered until something trigger an updatepanel1 refresh.

I think what you really need in lbtnSetVisibleUpdatePanel3 click event in the code behind:

updatepanel3.visible = true/false;

updatepanel1.update( ); // if that missing only updatepanel2 will be updated during the partial postback.

Wednesday, March 21, 2012

partial page update

hi, just learning the ajax for asp.net and would like to know how can i update the content by putting another control inside the update panel.

for example, inside this control panel, there is a label, when i click on the button, the label will disappear and then the login control will be visible? sorry, just a newb in asp.net and ajax. thanks in advance.Smile

Hi,

Just place them inside the UpdatePanel and code your controls as what you do using postback.

Does that make sense?


<asp:UpdatePanel ID="UpdatePanel 1" UpdateMode="Conditional" runat="server">
<ContentTemplate>

<!-- Your control Lable,Button etc -->

</ContentTemplate>
</asp:UpdatePanel>

Partial page rendering of user control

I have a user control. This user control has an update panel in it. Everything works great with the user control.

Now when I include the user control into a .aspx page I have it set up so that after a specific delay in seconds (set by a timer) it loads. But when it loads it causes a complete page refresh. I would like it so that only the area where the control is placed is refreshed.

I thought about wrapping the user control in the .aspx with an update panel but it throws a message of couldn't find a control in the user control. Basically it is a update panel inside of an update panel each mode set as conditional. When I run the user control without the update panel everything works fine.

Anyone have an idea of to go about this. Here is a bit of code:

<

asp:TimerID="timerCalendar"runat="server"OnTick="loadCalendar"Interval="2000"enabled="false"></asp:Timer>
<asp:UpdatePanelid="upCalendar"runat="server"UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTriggerControlID="timerCalendar"eventname="Tick"/>
</Triggers>
<ContentTemplate>
<asp:PlaceHolderID="phCalendar"runat="server"></asp:PlaceHolder>
</ContentTemplate>
</asp:UpdatePanel>User control is dynamically loaded and put into the placeholder when the timer is enabled.

thanks ^_^

Have you tried removing the UpdatePanel from the usercontrol... and instead of using a "PlaceHolder" to dynamically add your UserControl to... use an "UpdatePanel" in your page... then instead of "myPlaceHolder.Controls.Add(myUC);" do "myUpdatePanel.Controls.Add(myUC);"?


Good idea. Didn't think of that.

Question though. Within the user control I have a gridview. Would I add a trigger dynamically to the update panel in the page where the user control is dynamically loaded as well and set the trigger id to gridview in the control (do a findcontrol on the control id) or how would I go about getting the gridview to use the update panel as well?

Hope that makes sense. :)


Discovered the solution. I didn't have the mode for each updatepanel to conditional. Once I did this everything worked just fine. :)

Partial Page Updates

I have a page that originally had just one update panel that held everything inside of a few collapable panels on a 15 seconds timer trigger. The collapsable panels where sluggish in performance so I changed code where there were multiple update panels on the same 15 second timer trigger inside of the update panel that is not on a 15 second timer trigger. The problem is that I placed a label that wrote the current time to see if the outside panel was updating and it's still acting like it's on a timer like the ones inside the collapsable panels...but it's not on a timer anymore, just the inner update panels are. I've setEnablePartialRenderingto "true" in the script manager. What's my problem?

Here's my suedo-layout to give you a basic idea:

<timer1>
<updatepanel>
<content>
<label for current time>
<collapseablepanel extender>
<collapseablepanel1>
<updatepanel1>
<content></content>
<trigger=timer1></trigger>
</updatepanel1>
</collapsablepanel1>
<collapseablepanel2>
<updatepanel2>
<content></content>
<trigger=timer1></trigger>
</updatepanel2>
</collapsablepanel2>
<collapseablepanel3>
<updatepanel3>
<content></content>
<trigger=timer1></trigger>
</updatepanel3>
</collapsablepanel3>
</collapsablepanel extender>
</content>
</updatepanel>

Two things,

Firstly label control's update panel should be closed and rest should be seperate.

secondly try using literal control


Set the Timer as a trigger for the outer UpdatePanel.


I just want all of the inner update panels to update on the timer. The outer one is just for the collapsable panel extender, but it still updates with the rest of the inner ones for some reason. That's my problem; I just want the inner ones to update on the timer, but the outer one is updating even though it doesn't have a timer associated with it.


Set ChildrenAsTriggers to false on the outer one then. It's true by default.

Thank you! That worked...also, if I have 4 update panels set to the same trigger will it be like my page is loading 4 times? Should I do something different there?


The multiple panels shouldn't have a significant impact on performance either way. You can be sure by watching your page operate in Fiddler or FireBug, but it should just trigger a single partial postback per Tick that updates all four panels with its response.

Partial Page update using MenuItem and Ajax

Hello friends,

I am a new comer in your world.

I want to implement ajax in my site. My site has one default.aspx page. I use master page. In the master page there is a Menu.

I have a ContentPlaceHolder in Master page which is used in the default.aspx page. In the Menu each MenuItem has a NavigationUrl like

~/default.aspx?cid=. In the Page_load of default page i get the value of (cid) and load the (ascx) control in the PlaceHolder. And, as u know

the total page gives a PostBack I want to implement AJAX here. So that when a menu will be clicked only the Content of the PlaceHolder will

be updated. Hope i can make u understand !

Can any one help me with a guiding example......


To do something like that, an UpdatePanel isn't your best choice. You can use something like an IFRAME (http://www.w3schools.com/tags/tag_iframe.asp) or CSS to make the header static (seehttp://www.cssplay.co.uk/layouts/; a cool layout ishttp://www.cssplay.co.uk/layouts/fixit.html)

-Damien


Check it out:
http://geekswithblogs.net/rashid/archive/2007/08/11/Loading-UserControl-Dynamically-in-UpdatePanel.aspx


Sorry I didn't read your post correctly... I mentally skipped over the ASCX and saw ASPX. :) My previous post was based on that...

Sorry again,
-Damien


Sorry to reply late friends..

Thank u Kazi....

It worked fine....



Would you pls mark it as answer.


http://geekswithblogs.net/rashid/archive/2007/08/11/Loading-UserControl-Dynamically-in-UpdatePanel.aspx

Partial page update question

Why isn't this section of code not calling mychkShowLegend_CheckedChanged in my code behind? I can put the same code that changes the visible to true/false based on checked in my PageLoad, and it works...otherwise, I take it out of the PageLoad and just leave it in thechkShowLegend_CheckedChanged and it doesn't work. Here's my code:
 <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" /> <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:CheckBox ID="chkShowLegend" runat="server" AutoPostBack="True" Text="Notification Legend" />  <asp:Panel ID="Legend" runat="server" Visible="false"> <div id="lblLegend" style="Z-INDEX: 3; WIDTH: 477px; HEIGHT: 115px; border: solid 1px; padding-right: 5px; padding-left: 7px; padding-bottom: 5px; padding-top: 5px;" align="left" runat="server"> <font face="Arial" size="4"> <span style="font-size: 10pt;"> <span style="color: black"><strong>Black Text</strong></span> - Interval value received; operating environment normal<br /> <span style="color: gray"><strong>Gray Text</strong></span> - Interval value not received; previous valid interval substituted<br /> <span style="color: royalblue"><strong>Blue Text</strong></span> - Setpoint has changed from previous interval value<br /> <span style="color: crimson"><strong>Red Text</strong></span> - OOME for this interval<br /> <span style="color: darkorange"><strong>Orange Text</strong></span> - SCADA value is out of range compared to setpoints<br /> <span style="color: forestgreen"><strong>Green Text</strong></span> - LIP value has a different sign (+/-) compared to previous interval<br /> *Please check above indicators for current interval; multiple indicators are possible </span> </font> </div> </asp:Panel> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="chkShowLegend" EventName="CheckedChanged" /> </Triggers> </asp:UpdatePanel>In my code behind: protected void chkShowLegend_CheckedChanged(object sender, EventArgs e) { if (chkShowLegend.Checked) Legend.Visible = true; else Legend.Visible = false; }
 

I have tried your code, its working perfectly for me without any modification to your code.

canyou try by removing <triggers> section of update panel sincechkbox is inside the updatepanel it will automatically taken as atrigger(since childrenastriggers property of updatepanel is havingdefault value "true").

Some references.

http://ajax.asp.net/docs/mref/P_System_Web_UI_UpdatePanel_ChildrenAsTriggers.aspx

http://ajax.asp.net/docs/mref/P_System_Web_UI_UpdatePanel_UpdateMode.aspx

Isuppose you are using other update panels alose on the page. which maycausing the issue.In that case its better if you can put the completepage code so that we can look into that.


Removing the trigger section worked perfectly. I do have multiple update panels on this page and I was wondering if that was causing problems; the other two have timers as triggers, a 1 second timer and a 30 second timer.

Thanks for the help!

partial page update in a usercontrol on a master page

OK, I've installed AJAX Extensions, watched the tutorial video and tried to use the partial page update as follows: I have a user control which contains hyperlinks for paging back and forth and a datalist which displays the current page of products: <asp:UpdatePanelID="UpdatePanel1"runat="server"> <ContentTemplate> <asp:HyperLinkID="hLink_Previous"CssClass="paging_Text"Visible="false"runat="server">Previous</asp:HyperLink> <asp:LabelID="label_Paging"CssClass="paging_Text"Visible="false"runat="server"/> <asp:HyperLinkID="hLink_Next"CssClass="paging_Text"Visible="false"runat="server">Next</asp:HyperLink> <asp:DataListID="dataList_Products"RepeatColumns="2"RepeatDirection="Horizontal"runat="server"EnableViewState="False"OnItemCommand="dataList_Products_ItemCommand"> <ItemTemplate> <tableclass="dataList_Products_Table"cellpadding="0"align="left"> <trclass="dataList_Products_Table_Row"> <tdalign=centerclass="dataList_Products_Table_Cell_1"> <ahref='Product.aspx?P=<%# Eval("ProductID")%>'> <imgclass="small_Image"src='ProductImages/<%# Eval("Image1FileName")%>'/> </a> </td> <tdclass="dataList_Products_Table_Cell_2"> <aclass="product_Name"href='Product.aspx?P=<%# Eval("ProductID")%>'> <%# Eval("Name")%> </a> <br/> <spanclass="product_Description"> <%# Eval("Description")%> <br/> <br/> Price: </span> <spanclass="product_Price"> <%# Eval("Price","{0:C}")%> </span> <br/> <asp:ButtonID="btn_AddToCart"Text="Add to Cart"CssClass="small_Button_Text"CommandArgument='<%# Eval("ProductID")%>'runat="server"/> </td> </tr> </table> </ItemTemplate> </asp:DataList> </ContentTemplate></asp:UpdatePanel> I use this within the contentPlaceHolder on the Master page. I want only this bit to update when I navigate between pages but looking at the triggers collection, I can only see the datalist and ScriptManager controls - how do I hook into the previous and next page hyperlinks and their onClick event to enable the page update ? Thanks AR

Hi,

HyperLink control doesn't have click event.

You can use LinkButton control that has a similar layout like hyperlink to achieve so.

Hope this helps.