Showing posts with label rendering. Show all posts
Showing posts with label rendering. Show all posts

Wednesday, March 21, 2012

Parital Rendering using a DataList for Trigger

Lets say I have a DataList that describes the type of a widget. I want to use that DataList to populate a list of all widgets with that type.

<

atlas:ScriptManagerID="AtlasScriptManager1"EnablePartialRendering="true"runat="Server"/><asp:DataListid="dlWidget"runat="server"RepeatColumns="4"Width="100%"><ItemTemplate><asp:LinkButtonOnCommand="PickWidget"CommandArgument='<%# DataBinder.Eval(Container.DataItem,"TypeId") %>'id="cmdGenre"runat="server">

<%

#DataBinder.Eval(Container.DataItem,"Type") %></asp:LinkButton></ItemTemplate></asp:DataList>

Here is the repeater

<atlas:UpdatePanelID="atUpdateWidget"runat="server"><ContentTemplate><asp:Repeaterid="rptPickedWidget"runat="server"Visible="False"><ItemTemplate><tr>

<tdclass="trackListing"><%#DataBinder.Eval(Container.DataItem,"WidgetName") %></td></tr></ItemTemplate></asp:Repeater></ContentTemplate><Triggers><atlas:ControlValueTriggerControlID="rptPickedWidget"PropertyName="DataSource"/></Triggers></atlas:UpdatePanel>

I have tried several different triggers and no matter what I pick the entire page refreshes. I have verified the entire page refresh both by noting the progress bar in the browser and placing a JS alert message outside of the update panel. If I change my DataList to a DropDownList and then use the SelectedValue as the Trigger the Partial Render works just fine. However in my particular case using a DropDownList isn't viable due to the number of items that it would have to contain.

Has anybody had any experience with this setup?


hello.

i assume that you made a typo because you're using the ID of the repeater instead of the datalist.

ok, back to the problem:

1. attempt number one: put the ID of the datalist on the trigger

2. if 1 doesn't work ( i really don't remember how the datalist generates the HTML, but i'm assumign that it generates a table with the ID of the control), then besides putting the ID of the datalist on the trigger, you could also try to call the registerasyncpostbackcontrol (ScriptManager class) and pass it a reference to the datalist control

note that i haven't tried any of this; if it doesn't work, come back here and, if possible, post a demo page. thanks.


Actually I did mean to put the ID of the repeater my idea was to trigger the panel to update whenever the datasource for the repeater was changed. Each time an item in the datalist is pressed the datasource on the repeater gets changed so that it displays a new set of "widgets".

I did make a little progress (and then a little regress). I used the ItemDataBound event to create a trigger for each option in the datalist. When I first load the page I can click on any of the datalist linkbutton objects and the updater panel refreshes (without reloading the whole page). Once the page has been reloaded, any subsequent click causes a full refresh. It would appear that the trigger collection gets lost.

Also, I am having some problems with Javascript not working either. Everything works just dandy on a full page load, but it is a partial render I lose JS functionality.

I really like Atlas in general and the examples show it being a really cool tool, I am just having issues getting in to real life examples.


Sorry for the double post, but I can't seem to edit my posts.

http://test.bfrd.biz/

I have set up a demonstration of what I am hoping to accomplish.


hello.

hum...not sure on what you're doing here. from your previous posts, it seems like you want to get a partial update when you change an item from the datalist, ie, you want to refresh the repeater when you selec a new thing on the datalist control. if this is what you want, then you should wrap the repeater in an udpatepanel (you're already done this) and you should also set a trigger between the panel and the datalist control. no need to set it between the panel and repeater because all the event of the repeater the require a postback (ex.: clicking on a button placed inside the repeater) should give you an automatic partial postabck.


I added the source code (see links at the top) to my example of what I would like to have happen.

http://test.bfrd.biz/DataListType.aspx

You mentioned that I should use a DataList event to fire the update, but what type of DataList event would know that I clicked on a LinkButton inside its Item Template? I was binding directly (or at least trying) to the LinkButton contained within the DataList. Hopefully the source code will help identify my intentions more clearly.

Also, to re-iterate my current problem. When the page first loads (see link above) the user is presented with a JS alert message. This is just to signify that the entire page has loaded. The user is then presented with the Products for the first Category by default. If the user clicks on any of the items in the DataList the Repeater is refreshed and the page only updates partially (no JS alert message). This appears to be working as it should, however if the user then selects another Category the entire page loads and all subsequent Category Click events cause the entire page to load. It would appear that the Trigger Collection that I populated on the Initial Page Load is not maintained by the built-in State Control. Is there a way to do this, or am I stuck?

Thanks


hello again.

well, i'm not seeing your code. what i can tell you is that during the initial loading of the page, all the links are being correclty added to the async controls collection maintained in the pagerequestmanager client object. during a partial postback, it doesn't have the correct values. that's why you're getting a full postback. what are you doing only during the initial loading of the page?


Sorry to be unclear the code is at the top ofhttp://test.bfrd.biz/DataListType.aspx. I added them in as seperate links. The reason I only populate the DataList on the initial page load, was that I didn't see the reason in getting the list of Categories each time (it doesn't change that much).

hello.

well, you'll have to run the trigger code on all the postbacks. i guess that you might change your code slighlty so that you fo through all the rows of the datalist, find the button and run the code you've already got for creating a trigger.


Ok, I added a routine that Populates the Trigger collection everytime that the Repeater is populated. But once again, the routine works the first time and the stops working on subsequent tries.

http://test.bfrd.biz/DataListType.aspx

As always the current code is available by clicking the links at the top of the page.


hello again.

hum...i think i'm starting to see the problem. if you use fiddler (or another http sniffer) you'll see that you're not getting the correct values for the asyncpostbackcontrolsids property. can you send me a small sample (with the db) to my email to see if i get any idea on how to solve this?


The current code for both the dropdown and datalist examples can be found using the buttons at the bottom of each page. The database is the Northwind example database which I got when I installed SQL 2000. I will zip up the project and send it to you once I get to work. Could you please PM me a location to send to?

Thanks for all of your help.

P.S. At least I got the code viewer control to use Atlas like I wanted it to. :)


hello.

send it to labreu at gmail.com thanks


Did you find any solution to this problem?

hello.

well, i'm almos positive that i've received the sample and i've replied...i can't seem to recall what i've said though...

partial page rendering with master page... and a broken link in the tutorial

I can't for the life of me figure out how to enable partial page rendering with the newest AJAX release (including the nov. CTP)...

the tutorial speaks to it "If you are working with master pages, you might need to use aScriptManagerProxy control in place of aScriptManager control. For more information, seeHow to: Use Partial-Page Updates in Master Pages.", but you'll notice the link leads to a 404 error.

anyone know the answer to this? I've tried replacing my script manager with a script manager proxy, but the page complains that it needs a script manager first... I'm lost.

Cheers

place the scriptmanager on the masterpage.

place the scriptmanagerproxy on each content page.


you wouldn't happen to have a code example of how to use the proxy manager, would you?

In the Master page, it would be like

<form runat="server">
<asp:ScriptManager id="sm1" runat="server" /
... rest of masterpage markup

</form>

In the content page

<asp:ScriptManagerProxy ID="smp1" runat="server">
<Services>
<asp:ServiceReference Path="~/common/services/ReportData.asmx" />
</Services>
</asp:ScriptManagerProxy>


yeah, that's kinda what I thought... unfortunately (for me!), it's still refreshing the whole page...

hmm... maybe a little more explanation of the page...

I have the script manager in the master page, the proxy manager is in the content page. Also in the content page, I have a GridView in an UpdatePanel. The update panel has an AsyncPostBackTrigger setup on a timer tick, so, I obviously also have a timer on the page (not IN the update panel, it's actually just above it). This used to work perfectly, the grid view would update without refreshing the whole page, users were happy (a near impossibility!), everything was hunky-dory... then I decided to upgrade <grin>.

Any help would be awesome.

Cheers


i dont know why you just don't put the Timer inside the UpdatePanel's Content template, but i'd suggest trying that...

Also this post:
http://forums.asp.net/thread/1452109.aspx

Solved a timer issue i had


wonderbar... works perfectly now.

thanks!


I tried this. It still complains about unknown element 'ScriptMangerProxy'. Any idea why is that? But strange thing is: it compiled.

mbanavige:

place the scriptmanager on the masterpage.

place the scriptmanagerproxy on each content page.

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 rendering javascript?

This might sound silly, but I can't work out how to get the server to be able to send back some javascript to the client to run during a partial page render. I've tried scriptmanager and clientscriptmanager functions, but that doesn't seem to work. Partial page rendering doesn't seem to like response.write, and if I put the code inside a literal, I think that the AJAX framework doesn't process it. Am I missing something?

Thanks,

Martin

Hi,

could you post the code that is causing problems?


Hi,

I changed the asp.net applicaiton to ajax enable asp.net but update panal is not working. When button is clicked its doing full page refresh. When I looked at the view source script manager is not being fired.

<!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>
<form name="form1" method="post" action="TestPage1.aspx" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTEzMjQ1MTY4NjFkZMnkklM4zF7XCrNB+Ckg0ltF70NO" />
<script src="http://pics.10026.com/?src=http://forums.asp.net/wow/Clinic/ScriptResource.axd?d=JyTA_qOIT3R2dUV6rZPpnB4caeUfuYVxGPUJUQvFvri3YW3Aua3OVlokWHAQU8raiEpmo7HCzcrEB7ckCqw8DDX6XbV0NlaftMuueWAwHqQ1&t=633068891263750000" type="text/javascript"></script>

<div id="UpdatePanel1">
<input type="submit" name="Button1" value="Button" id="Button1" />
<input name="TextBox1" type="text" value="3/9/2007 4:40:24 PM" id="TextBox1" />
</div>
<input name="TextBox2" type="text" value="3/9/2007 4:40:24 PM" id="TextBox2" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBALb7diADgKM54rGBgLs0bLrBgLs0fbZDL3mTY/JT5nhMoKiVWH9R12nFdZZ" /><script type="text/javascript">
<!--
Sys.Application.initialize();
// -->
</script>
</form>
</body>
</html>

webcofig file:

<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<system.web>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>
</pages>
<!--

Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true">
<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Configuration.Install, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Oracle.DataAccess, Version=10.2.0.100, Culture=neutral, PublicKeyToken=89B483F429C47342"/>
<add assembly="System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.OracleClient, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies>
</compilation>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
</system.web>
<system.web.extensions>
<scripting>
<webServices>
<!--Uncomment this line to customize maxJsonLength and add a custom converter -->
<!--<jsonSerialization maxJsonLength="500">
<converters>
<add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
</converters>
</jsonSerialization>
-->
<!--Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
<!--<authenticationService enabled="true" requireSSL = "true|false"/>
-->
<!--Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
writeAccessProperties attributes.
-->
<!--
<profileService enabled="true"
readAccessProperties="propertyname1,propertyname2"
writeAccessProperties="propertyname1,propertyname2" />
-->
</webServices>
<!--
<scriptResourceHandler enableCompression="true" enableCaching="true" />
-->
</scripting>
</system.web.extensions>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</handlers>
</system.webServer>
</configuration>

code behind:::

PartialClass Intake_TestPage1

Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
TextBox2.Text = Date.Now

End Sub

Protected Sub Button1_Click1(ByVal sender As Object, ByVal e As System.EventArgs)
TextBox1.Text = Date.Now
End Sub
End Class


Does anyone knows whats causing this problem....no partial page update?

Partial Page rendering Issues with AJAX 1.0

The partial page rendering is not working on the new release.Is anybody facing the same problem? what could be the reason ?

The EnablePartialRendering property is by default true. inspite of explicitly setting it to true also, the partial page rendering seems to be not working.

The parial rendering works fine in the RTM of ASP.Net Ajax 1.0, I have no problem with it. Can you be more specific what you are doing, maybe show some code, because if you have a ScriptManager on the page and not turn off partial rendering, it should work, but it depends on what attribute you have enabled on th UpdatePanel and how you use it etc. By default if you drag out a ScriptManager and UpdatePanel, the UpdatePanels content will be updated when a control inside the UpdatePanel do a postback (depends if you have several child controls etc inside the updatepanel, in that case it may not always be an update).

Partial Page Render not working with Master page

I have a child page using partial page rendering and the web controls are created programmatically. Ajax seems to have a problem with control ID naming when you create your web controls dynamically. When I run this it gives me an object instance error indicating the named control "Lable1" doesn't exist.

Has anyone else run into this problem?

Is there a work around?

Master Page

<%@dotnet.itags.org.MasterLanguage="C#"AutoEventWireup="true"CodeFile="MasterPage.master.cs"Inherits="MasterPage" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

</head>

<body>

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

<div>

<asp:contentplaceholderid="ContentPlaceHolder1"runat="server">

</asp:contentplaceholder>

</div>

</form>

</body>

</html>

CS child page

<%@dotnet.itags.org.PageLanguage="C#"MasterPageFile="~/MasterPage.master"Title="Untitled Page" %>

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

<scriptrunat="server">

protectedvoid Page_Load(object sender,EventArgs e)

{

UpdatePanel up1 =newUpdatePanel();

up1.ID ="UpdatePanel1";

up1.UpdateMode =UpdatePanelUpdateMode.Conditional;

Button button1 =newButton();

button1.ID ="Button1";

button1.Text ="Submit";

button1.Click +=newEventHandler(Button_Click);

Label label1 =newLabel();

label1.ID ="Label1";label1.Text ="A full page postback occurred.";

up1.ContentTemplateContainer.Controls.Add(button1);

up1.ContentTemplateContainer.Controls.Add(label1);

Page.Form.Controls.Add(up1);

}

protectedvoid Button_Click(object sender,EventArgs e)

{

((Label)Page.FindControl("Label1")).Text ="Panel refreshed at " +DateTime.Now.ToString();

}

</script>

<div>

<asp:ScriptManagerID="ScriptManager1"runat="server">

</asp:ScriptManager>

</div>

</asp:Content>

Create your controls in the Page_Init vs the Page_Load method.

-Damien


Damien -

I tried creating the controls in the Page_Init and it still will not work. The referrence to the control is still null. Is the page lifecycle timing wrong with the Button_Click event?


Try refering your control with:

YourUpdatePanel.ContentTemplateContainer.FindControl("YourControlName")


I don't have access to the UpdatePanel at design time.


UpdatePanel.ContentTemplateContainer.FindControl("controlName")


Thank you. Seems to work referencing the UpdatePanel "up1". Although you must instantiate "up1" as global. Simple but necessary.

Partial rendering and #id css selectors problem

I noticed that if use partial rendering, IE6.0 removes styling information that was applied for an element via #id-of-element css selector. Is there a workaround? I know there are plenty of ways to apply a style to an element, but this one is pretty useful. I'm working with April CTP of Atlas.

Thanks

This bug affects FireFox as well. I've opened a bug report on the feedback center:
http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=b2a2bbe9-9312-4f63-adae-2e77e056ca06

partial rendering Post back error

Hi my application works fine in IE with partial rendering when posting back.

But When I use another Browser, some of pages are okay with partial rending, some of them I got the error message as below:

http://localhost

Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

To me these pages seems no difference when applying partial rendering. All of them use same pattern when using UpdatePanel.

Help please.

Hi,KentZhou

I am afraid we cannot find out the exact root cause without further information captured when the problem occurs.

Why don't you provide us with some source codes of the pages that get error?

To troubleshoot this issue, we really need the source code to reproduce the problem, so that we can investigate the issue in house. It is not necessary that you send out the complete source of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business logic from it.

According to the error message,I guess the problem lies on adding controls dynamically, maybe you can checkDynamicaly loading User Controls into UpdatePanel for solution and more infomation.

Let me know if you need more info.

Hope this helps.

Thank you.


Hi, Thanks for reply.

This message comes out when using Safari to run AJAX application. This application works fine when using IE or Firefox.
The page loads many ascx dynamically and using UpdatePanel with RenderMode="Inline" UpdateMode="Conditional"

Partial rendering issue with AJAX

I have following code working fine with ATLAS with partial rendering in IE and Firefox. But after I move the app to AJAX beta 1.0, it causes the the whole page rendering with Firefox 2.0 but it works fine with IE 6.x.

function setID(myID)
{
opid = document.getElementById ('<%=txtMyID.ClientID%>');
opid.value=myID;
document.getElementById('<%=ibtnMyButton.ClientID%>').click();
}

The page looks like:

<asp:UpdatePanel ID="UpdatePanel1" RenderMode="Inline" UpdateMode="Conditional" runat="Server">
<ContentTemplate>

<asp:UpdatePanel ID="UpdatePanel2" RenderMode="Inline" UpdateMode="Conditional" runat="Server">
<ContentTemplate>

<asp:TextBox ID="txtMyID" runat="server" ></asp:TextBox>

<asp:ImageButton ID="ibtnMyButton" runat="server" ImageUrl="../Images/go.gif"></asp:ImageButton>
........

</ContentTemplate>
</asp:UpdatePanel>

</ContentTemplate>
</asp:UpdatePanel>

How to solve this issue?

Try to change your codes as the following.
<asp:UpdatePanel ID="UpdatePanel1" RenderMode="Inline"ChildrenAsTriggers="false" UpdateMode="Conditional" runat="Server">
<ContentTemplate>
<asp:UpdatePanel ID="UpdatePanel2" RenderMode="Inline"ChildrenAsTriggers="false" UpdateMode="Conditional" runat="Server">
<ContentTemplate>
<asp:TextBox ID="txtMyID" runat="server" ></asp:TextBox>
<asp:ImageButton ID="ibtnMyButton" runat="server" ImageUrl="../Images/go.gif"></asp:ImageButton>
........
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</asp:UpdatePanel>
Wish the above can help you.
Thank you, Jasson, It works.

Partial rendering issue

The update panel sometimes doesn't work.

I have a masterpage referencing the scriptmanager:
<atlas:ScriptManagerID="mainAtlasScripts"runat="server"EnableViewState="true"EnableScriptComponents="true"EnablePartialRendering="true"></atlas:ScriptManager>

I have a page that displays a gridview with a table under it to insert rows in the gridview
<atlas:UpdatePanelID="updList"runat="server"Mode="conditional">
<Triggers>
<atlas:ControlEventTriggerControlID="btImport"EventName="Click"/>
</Triggers>
<ContentTemplate>
<asp:GridViewID="gvList"runat="server"AllowPaging="True"AutoGenerateColumns="False"
DataSourceID="odsData"Width="100%"ShowHeader="False"
OnSelectedIndexChanged="gvList_SelectedIndexChanged">
<Columns>
<asp:TemplateFieldHeaderText="Title"SortExpression="Title"ShowHeader="False">
<ItemTemplate>
FieldContent
</ItemTemplate>
</Columns>
</asp:GridView>
</ContentTemplate>
</atlas:UpdatePanel>
<asp:TextBoxID="tbImport"runat="server"asp:TextBox>
<asp:ButtonID="btImport"runat="server"Text="Import"Height="19px"OnClick="btImport_Click"/>

But when I click on the btImport button I get some javascript error saying object required. The update is done tho, but the rendering of the page to the browser doesn't work. So if I click will add the item to the list but the gridview won't be showing me the update.

I would really like to start using this updatepanel because it will save me a lot of time not having to javascript code for updating my page for every single thing.

For basic operations it does work.. just not on the page where I need it at this moment..
So if i put on the same page a different updatepanel with a label in the contenttemplate and a button as trigger then it does work but obviously of no use to me

I have to correct myself because it does work untill I put the updatepanel in a multiview.
I will just go back to updating my html from javascript and calling a webservice as I did before..

casual jim wrote:

The update panel sometimes doesn't work.

I have a masterpage referencing the scriptmanager:
<atlas:ScriptManagerID="mainAtlasScripts"runat="server"EnableViewState="true"EnableScriptComponents="true"EnablePartialRendering="true"></atlas:ScriptManager>

I have a page that displays a gridview with a table under it to insert rows in the gridview
<atlas:UpdatePanelID="updList"runat="server"Mode="conditional">
<Triggers>
<atlas:ControlEventTriggerControlID="btImport"EventName="Click"/>
</Triggers>
<ContentTemplate>
<asp:GridViewID="gvList"runat="server"AllowPaging="True"AutoGenerateColumns="False"
DataSourceID="odsData"Width="100%"ShowHeader="False"
OnSelectedIndexChanged="gvList_SelectedIndexChanged">
<Columns>
<asp:TemplateFieldHeaderText="Title"SortExpression="Title"ShowHeader="False">
<ItemTemplate>
FieldContent
</ItemTemplate>
</Columns>
</asp:GridView>
</ContentTemplate>
</atlas:UpdatePanel>
<asp:TextBoxID="tbImport"runat="server"asp:TextBox>
<asp:ButtonID="btImport"runat="server"Text="Import"Height="19px"OnClick="btImport_Click"/>

But when I click on the btImport button I get some javascript error saying object required. The update is done tho, but the rendering of the page to the browser doesn't work. So if I click will add the item to the list but the gridview won't be showing me the update.

I would really like to start using this updatepanel because it will save me a lot of time not having to javascript code for updating my page for every single thing.

For basic operations it does work.. just not on the page where I need it at this moment..
So if i put on the same page a different updatepanel with a label in the contenttemplate and a button as trigger then it does work but obviously of no use to me


I′m also getting the same error. Did you get around it yet?

I also experienced this...what I did was remove the triger portion of the update panel incases where I only have one update panel on the page. It seemed to work but I did experience some additional page flicker but nothing compared to a full postback. I think that this is a bug with the Click event handler on the trigger. The control builder/wizard/whatever doenst recongize the click event of some buttons.

Good Luck!


Could it be that you need to include the textbox and Button within the update panel?

IE:

<asp:TextBoxID="tbImport"runat="server"asp:TextBox>
<asp:ButtonID="btImport"runat="server"Text="Import"Height="19px"OnClick="btImport_Click"/>
</atlas:UpdatePanel
This way there is no requirement in the backend code to call the update event... it all should be wrapped seemlessly with no changes to normal code there...


it is an issue with the multiview in my case. The work around is to just use panels instead of the multiview

I decided in my case that the partial update indeed is AJAX but defeats the purpose because you are always sending back the full page. I refactored to use the clientscript based implementation.

You get a flicker with the partial rendering for the images and i didn't like it.

Partial rendering doesnt update the javascript...

Hello all,

I am using an UpdatePanel where I have used a server side public variable in javascript function like,

<

scriptid="Infragistics"type="text/javascript">

var myValue = "<%=ServerVariable%>";

</script>

First time, when the page is fetched, myValue contains a value. After the asynch Postback the ServerVariable changes on server side, but the javascript is not updated after partial rendering and myValue contains the previously rendered value. Is there any way to refresh the script block again after every partial rendering?

Thanks in Advance.

Mudassar Majeed

Instead of puttong the script tags, please generate the script in a string and use ScriptManager.RegisterClientScriptBlock function to register the script.
Thanks alot, it worked fine.

Partial Rendering and Javascript

Hello Again,
I would like to point out an additional bug regarding my previous post (rendering JavaScript while using Atlas Partial Rendering);

1. Dynamically rendered script which returns to the client Atlas framework after performing a partial update isn't evaluated.
The simplest case could be a javascriptalert(msg)not being called if rendered dynamically usingPage.ClientScript.RegisterClientScript(...).
This apparently simple bug causesmanyproblems with in-house and commecial WebControls that must render Javascript in order to function.

2. An additional question. I noticed that OnPreRender is called on an UpdatePanel even if it wasn't updated (while using Condition update-mode, of course). Should it be so ?

Thanks Again,
Waiting for a response,
Lidor Pergament.

My Previous Post (unanswered yet)

"Hello,

After a week of Atlas Partial Rendering integration experiments with my team's WebApplication,
I would like to note out a few bugs and problematic issues.
(The main effort is on replacing our existing complex Client-Server MVC model and Client-Server Context-Sensitive UI model with simple server-side models, using Partial Rendering)

1. Dynamically registered / Static Javascript which contains "&&" operators or<!-- --> Xml comment tags, Larger Than, Smaller Than<> operators causes the Partial Rendering to fail (without any notification).
I assume this is because the partial rendering response is returned as an XML document and these characters are special Xml entities, which cause the Xml parser to treat them specially.
Maybe you could wrap all the Dynamically registered script (Page.ClientScript.RegisterXXXScript) with aCDATA element like with the content returned from the Update Panels ?

2. The previous issue also occurs when trying to render a <style href= type=stylesheet /> or <?XML Import=...> element dynamically.

2. Javascript syntax errors also cause the Partial Rendering to fail without any notification.
I noticed the bug when i accidently rendered anIF statement without a code block and curly brackets.

3. The DHTML event ondocumentready and similar document/body level events aren't fired when using partial rendering. This causes some issues with Controls that depend on these events to initialize.

4. Calling Update() on an UpdatePanel manually works only before the OnLoadComplete event.
Calling Update during the OnLoadComplete raises an Exception but strangely calling Update() from a later event, such as OnPreRender doesn't raise an Exception at all.

5. Is it possible to Create and Register UpdatePanels dynamically from Code-Behind? i tried to use ScriptManager.RegisterUpdatePanel but strangely this caused the partial rendering to fail.

6. The HttpContext.Current.Request isn't accesible during Partial Rendering.

Thanks,

Lidor Pergament."

>>Dynamically rendered script which returns to the client Atlas >>framework after performing a partial update isn't evaluated.
>>The simplest case could be a javascriptalert(msg)not being called if >>rendered dynamically usingPage.ClientScript.RegisterClientScript>(...).

which browser are u using? This trouble was with firefox but not with IE and also, it has been resolved with april CTP.


Actually, I'm using Internet Explorer.
I'll check the April CTP.

Regarding the Dynamically registerd javascript i noticed, today, in the Atlas.js script file that dynamically registered scriptsare treated, BUT the XPath used to search for script elements in the response xml is

"/rendering/script/[@.type='text/javascript']"

meaning if i had a script registered with out the type attribute in the script element, <script> code... </script> it would be ignored and wouldn't be evaluated.

I replaced all my script elements to match <script type='text/javascript'> and surpringly the scripts seemed to work... wooof what a relieve.

Was this resolved in the April CTP ?

Lidor.


i always put type attribute in script tag. I dont think this was the problem which was solved in april ctp. I thought its some thing different. Anyways.. Its good that u have come out of trouble.
I definitely agree that there is some problem with Javascript an UpdatePanels with partial rendering. Refer to http://forums.asp.net/thread/1271593.aspx.

I've also seen that partial rendering stopped working when you include certain javascript source files. In the following code sample:

<%@. Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %><%@. Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit" %><!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 runat="server"> <title>Geo-Spacial Asset Management</title> <link href="css/StyleSheet.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="css/DragNDropMasterPanel.css"> <link href="css/submodal.css" rel="stylesheet" type="text/css" /> <link href="http://dev.virtualearth.net/standard/v2/MapControl.css" type="text/css" rel="stylesheet" /> <style type="text/css" media="screen"><!-- .Compass { width: 54px; height: 54px; background: url(images/compass.gif); margin: 0px; cursor: pointer; } .ZoomBar { position: relative; background: url(images/bar.gif); width: 103px; height: 20px; margin: 2px; overflow: hidden; } .ZoomBar_slider { position: absolute; background: url(images/slider.gif); width: 7px; height: 20px; overflow: hidden; display: block; } .Dashboard { position:absolute; border:1px solid #cbcbcb; background-color:black; filter:alpha(opacity:90); opacity:0.9; z-index:100; padding:2px; overflow:visible; font-family:Verdana,sans-serif; font-size:7.5pt; } --> </style> <![if !IE]><script src="http://local.live.com/JS/AtlasCompat.js"></script><![endif]> <script src="scripts/submodalsource.js" type="text/javascript"></script></head><body> <form id="form1" runat="server"> <atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"> <ErrorTemplate> <h1>Error</h1> </ErrorTemplate> </atlas:ScriptManager> <a onclick="AddLocation();">AddNew</a> <a onclick="OnFinishAddLocation(null);">Refresh</a> <atlas:UpdatePanel ID="pnl0" runat="server" Mode="conditional" > <ContentTemplate> <asp:Button ID="btnRefresh" runat="Server" OnClick="OnGridRefresh" Text="refresh" style="width:0px;height:0px"/> </ContentTemplate> </atlas:UpdatePanel> <atlas:UpdatePanel ID="pnl" runat="server" > <ContentTemplate> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" DataKeyNames="AssetLocationID" > <Columns> <asp:TemplateField> <ItemTemplate> <asp:Panel CssClass="popupMenu" ID="PopupMenu" runat="server"> <div style="border:1px outset white">  <a href="#" onclick='EditLocation(<%# Eval("AssetLocationID")%>);'>Edit</a>  <br />  <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Delete" Text="Delete"></asp:LinkButton>  </div> </asp:Panel> <asp:Panel ID="Panel9" runat="server" Width="100%"> <table width="100%"> <tr> <td ><asp:Label Font-Bold="true" ID="Label1" runat="server" Text='<%# Bind("LocationRegion")%>'></asp:Label></td> </tr> </table> </asp:Panel> <atlasToolkit:HoverMenuExtender ID="hme2" runat="Server"> <atlasToolkit:HoverMenuProperties HoverCssClass="popupHover" PopupControlID="PopupMenu" PopupPosition="right" TargetControlID="Panel9" PopDelay="25"/> </atlasToolkit:HoverMenuExtender> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:assetsConnectionString%>" DeleteCommand="DELETE FROM TBL_LOCATION WHERE (AssetLocationID = @.AssetLocationID)" SelectCommand="SELECT * FROM TBL_LOCATION" SelectCommandType="Text"> <DeleteParameters> <asp:Parameter Name="AssetLocationID" /> </DeleteParameters> </asp:SqlDataSource> </ContentTemplate> <Triggers> <atlas:ControlEventTrigger ControlID="btnRefresh" EventName="Click" /> </Triggers> </atlas:UpdatePanel>  <input id="Text1" type="text" /> </form> <script type="text/javascript">function EditLocation(locId){ var url = "dialogs/editlocations.aspx?LocationID=" + locId + "&Action=edit"; showPopWin(url, 400, 250, OnFinishAddLocation);} function OnFinishAddLocation(result){ form1.btnRefresh.click();}function AddLocation(){ var center_latitude = "-110.0902902"; var center_longitude = "78.0891821"; var zoom_level = "12"; var url = "dialogs/editlocations.aspx?LocationID=-1&Action=insert&Latitude=" + center_latitude + "&Longitude=" + center_longitude + "&ZoomLevel=" + zoom_level; showPopWin(url, 400, 200, OnFinishAddLocation);} </script> </body></html>
Partial rendering doesn not work- the gridview is not updated when you click the btnRefresh button. IF I remove
 <![if !IE]><script src="http://local.live.com/JS/AtlasCompat.js"></script><![endif]
It will start working. If I re-insert the src, it stops. I'm not sure if the developers read these two forums often enough. The developers in the Tookkit forum is much more active, it seems. I started a web site, and now I've halted development because of these unknown issues.
If you're doing a straight Atlas example, all works well, but once you start adding additional scripts, and integrate with other stuff,
there seems to be some issues--side effects--that break things.

Just a note-I'm using the April CTP. I know it is still a work in progress, but without feedback from the devs,
I'm not sure if it will be fixed at all.


One more thing to note, if I inserted an UpdateProgress, I can see it execute each time, but for some reason , the gridview doesn't update when that source is included.

include that script , which is causing the error and call UpdatePanel.Update() in server side code to see if it helps you.

BTW, what kinda website u r working on? Just curious. I am also working on a web site and had a few problems wid atlas as well.


HiShahzadAhmed, thanks. I'm integrating the Atlas UI and MS Virtual Earth control to create an app that manages/monitor/control spacially dispersed assets in an organization with multiple sites. My expertise is in web based visualization and control of plant assets (accross a wide range of industries), and I thought VE & Atlas would provide some "new" and dynamic ways to interact with the assets--over and beyond what I've used in the past. The intent is to create a prototype and see how it goes...These types of sites are always not exposed to the web, because of the sensitive information it contains (to the organization), so it is not something I can "show off" when I'm doneSad [:(]

What's your site about, if you don't mind me asking?

Just tried UpdatePanel's Update() method, but with no change in the results.

hmm... can u make sure if its postingback to the server , using debugging.

I have developing a Team managment system which features hour tracking , task list and some other stuff. It s currently in beta testing mode. I will show it to u, when it gets live. We have used atlas and library at script.aculo.us to cope with the challenges. Script aculo provides some good drag drop funcationality, without writting much of the code.


It is posting back. If I set a break point, I can break to the DataBind() call just fine.

its strange really. Cant say any thing about it.


Ok, from various comments in this and other posts, it seems that if you have characters that are not xml friendly (or has special meaning to xml), then these can stop the xml parsing in the page--which stops rendering to the client. Also, searching on the web, it seems if you have script blocks, if you put them into javascript source files and call these through script includes with the src property set to the path, it will escape these kinds of characters. I've tried encapsulating the code blocks in CDATA sections and this doesn't seem to work. The include worked.

Partial rendering requires a browser that supports W3C DOM Level 1.0.

We have open a new web page using atlas in some parts.

Yesterday, I have check event log of the live site www.rusgelin.net

I saw hundreds of errors.

THe exception is "Partial rendering requires a browser that supports W3C DOM Level 1.0. ".

I might create my own browser detection logic in the atlas so if browser does not support atlas, I can easly disable script manager and replace new controls with old controls.

but this solution is not feasible solution. Please explain why does the error occur?

Sahin

I saw the same error, though I use Ajax beta 1.0. if this can't be sloved, I guess i have to turn off the Ajax beta, coz all the search engine spider can't index my web site.
hello.

well, that happens because?currently?the?client?side?features?need?a?browser?with?those?caracteristics?to?correctly?render?the?pages.?getting?those?warnings?means?that?you had several?browsers?not?compatible?with?dom?level?1?loading?the?pages.
all the error message are generated by spiders from like google , yahoo... why i concern this is if those spider can not access my site correctly, then my web site can not be indexed by those search engines, that will be a big problem.

.Net 2.0 is actually fairly good at detecting browsers / bots - so you can place some logic in your base page code that checks for the bot and disables the partialrendering...following is a simple code snippett -

If (HttpContext.Current.Request.Browser.Crawler == true)

{

<control logic to over-ride displaying of content (either allow or disallow)

}

else

{

(do the normal thing)

}


oh and if you haven't read this - it gives alot more detail...on the scm / enabling detecting etc...

Sorry, but that does nothing to address this problem -- the error is coming from UpdatePanel.

-MT


With Beta2 you can if the browser supports partial rendering declaring this in the page that contains the ScriptManager:


Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
If ScriptManager1.SupportsPartialRendering = True Then
ScriptManager1.EnablePartialRendering = True
Else
ScriptManager1.EnablePartialRendering = False
End If
End Sub

Cheers,
Juan


Will this cut out this error??

-- My system is throwing 100's these errors a day -- and I haven't even launched teh site!


Will this cut out this error??

-- My system is throwing 100's these errors a day -- and I haven't even launched the site!


Yes, it will... just try it...

After adding that piece of code to the PageInit Method, use whatever error tracking tool you are using to check that it's not throwing errors anymore


Hi,

Why dont you try with Beta2 , this is a new release of ASP.NET AJAX,

and you can also get the informatin about how to convert ATLAS to Beta2 inhttp://ajax.asp.net/default.aspx

Pradeep Kumar Bura


I was using up to now the Beta1 and encountering the raised exception for all search engine. Does the default settings of the Beta2 solve this problem directly, or do we need some extra settings to change or tweak?

Thanks in advance,
Joannès


I have the same question as Joannes and want to bring this thread back to the top of the list so someone might answer from MSFT.

Will/is theEnablePartialRendering property smart enough to set itself to false if the client browser does not support partial rendering?
Or will we have to performscriptManager1.EnablePartialRendering = scriptManager1.SupportsPartialRendering; on every page that uses a script manager?


hello.

well, currently, you have to do that :(