Showing posts with label trigger. Show all posts
Showing posts with label trigger. Show all posts

Monday, March 26, 2012

Atlas update panel

I have atlas update panel which works perfect for couple of hours or even a day or two.

Then it stops render part of page when trigger fires submit.

Just render nothing.

And that happens on all of my pages, where I use atlas.

What that could be?

I tried to create and define triggers in page_init event but still the same.

And I can't even test this behaviour because on the beggining it works.

Otherwise, I have to remove atlas from all pages because my users are complaining.

Any idea?

regards,Simon

Got a question, maybe not even related. When you see the problem is the session timeout? Got a problem before with the session.

Atlas update control doesnt refresh the gridView content

I have atlas update panel with mode=conditional which means that it should refresh the gridView only when trigger is fired.

I create a trigger which fires when selectedValue is changed on dropdownlist.

But gridView is refreshed only first time, when dropDownList is changed. All other changes in dropDown - gridView remains the same. AnyBody know why?

If I change Mode to always than gridView is refreshed on every dropDown change.

Here is the example:

<

asp:DropDownListID="DropDownList2"runat="server"AutoPostBack="True"><asp:ListItemValue="False">Active</asp:ListItem><asp:ListItemValue="True">Completed</asp:ListItem></asp:DropDownList>

<

atlas:UpdatePanelID="p1"runat="server"Mode="Conditional"><ContentTemplate><asp:GridViewID="GridView1"CssClass="gridView"AlternatingRowStyle-CssClass="even"GridLines="None"runat="server"AllowPaging="True"AllowSorting="True"AutoGenerateColumns="False"DataKeyNames="taskID"DataSourceID="ObjectDataSource1"><Columns><asp:CommandFieldShowEditButton="True"/><asp:BoundFieldDataField="name"HeaderText="name"SortExpression="name"/><asp:CheckBoxFieldDataField="complete"HeaderText="complete"SortExpression="complete"/></Columns><AlternatingRowStyleCssClass="even"/></asp:GridView></ContentTemplate><Triggers><atlas:ControlValueTriggerControlID="DropDownList2"PropertyName="SelectedValue"/></Triggers></atlas:UpdatePanel>

Regards,S

hello.

does this page work there:

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

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

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:DropDownList runat="server" id="drop" AutoPostBack="true">
<asp:ListItem Text="True" />
<asp:ListItem Text="False" />
</asp:DropDownList>
<atlas:ScriptManager runat="server" id="manager" EnablePartialRendering="true" />
<atlas:UpdatePanel runat="server" ID="panel">
<ContentTemplate>
<%=DateTime.Now.ToString() %>
</ContentTemplate>
<Triggers>
<atlas:ControlEventTrigger ControlID="drop" EventName="SelectedIndexChanged" />
</Triggers>
</atlas:UpdatePanel>
</form>
</body>
</html>


Hello,

yes, your example works.

In fact if I change value trigger with event trigger then my example also works.

Replace:


<atlas:ControlValueTrigger ControlID="DropDownList2" PropertyName="SelectedIndex" />

with

<atlas:ControlEventTrigger ControlID="DropDownList2" EventName="SelectedIndexChanged" />

What is wrong with ControlValueTrigger? I found this example at your page from video demonstration.

Regards,Simon


hello.

i think that replacing the controleventtrigger with the controlvaluetrigger still works in the code i've posted previouslly...doesn't it tun there when you use that trigger?


If I use your example with:

<atlas:ControlValueTrigger ControlID="drop" PropertyName="SelectedValue"/>
OR
<atlas:ControlValueTrigger ControlID="drop" PropertyName="SelectedIndex" />

It works only when selectedValue is not True, so, when you not select first option.
So, it refresh time every second attempt.

If you add more options into your example:

<asp:ListItem Text="True"/>
<asp:ListItem Text="False"/>
<asp:ListItem Text="Test"/>
<asp:ListItem Text="Test1" />

it works for all other options too, only if selectedIndex>0(if selectedValue<>"True").
Why?

Thanks,Simon


hello again.

are you saying that changing from true to false causes a partial postback but changing from false to true doesn't? that's not what i'm seeing here...btw, i've used this:

<atlas:ControlValueTrigger ControlID="drop" PropertyName="SelectedIndex" />


Yes, that is exactly what is happening.

First I change value to false and partial postback is happened.
Then I change value to True, no partial postback.
Then I change value to false, partial postback is happened.
Then I change value to True, no partial postback.
and so on...

Every change of dropdown to first choice(selectedIndex=0) creates no postback.

My code is exactly the same as yours.I copied it from here.
No master page, no any other code.
I install atlassetup.msi from

http://www.microsoft.com/downloads/details.aspx?FamilyId=B01DC501-B3C1-4EC0-93F0-7DAC68D2F787&displaylang=en

and create empty atlas web project.
Create test page and put your script into it.

Any idea? I can send you my web.cofig file and my page if you want.

Regards,Simon


hello again.

just to be sure, here's the code i'm running:

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

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

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:DropDownList runat="server" id="drop" AutoPostBack="true">
<asp:ListItem Text="True" />
<asp:ListItem Text="False" />
</asp:DropDownList>
<atlas:ScriptManager runat="server" id="manager" EnablePartialRendering="true" />
<atlas:UpdatePanel runat="server" ID="panel">
<ContentTemplate>
<%=DateTime.Now.ToString() %>
</ContentTemplate>
<Triggers>
<atlas:ControlValueTrigger ControlID="drop" PropertyName="SelectedIndex" />
</Triggers>
</atlas:UpdatePanel>
<%=DateTime.Now.ToString() %>
</form>
</body>
</html>


Hello,

well my code is exact the same only that I use code behind.

So, only difference is top most line:
<%@.PageLanguage="C#"AutoEventWireup="true"CodeFile="test.aspx.cs"Inherits="test" %>

Do you know, how to include atlas into existing web application? Set references to atlas.dll and what else?

When creating new web site it's simple, just select atlas web site.

Regards,Simon


hello.

well, normally you must also add some entries on the web.config. if you look at the your atlas installation path, you'll find a web.config file that has the necessary entries. copying those entries to your web.config should be enough. you might also need to configure IIS if you're using bridges and you have not installed atlas msi on the server that is hosting your app.

Saturday, March 24, 2012

Atlas trigger not quite working

Hi,

I have got a serious problem with triggersnot updating the content of UpdatePanel at appropriate time. Here's thesituation:

The master page holds three fieldset elements -each of those is dragable and resizable (YUI library). Inside each ofthose is an UpdatePanel. Each UpdatePanel holds part of the left sidemenu, so parts are separately draggable around the UI.
Next, thepage that uses this master page further has four (4) more draggablefieldsets with UpdatePanel's inside. Each of these panels holds a partof the final content - drill down. So I need to update each lowerUpdatePanel when the upper one changes. Each of the content panelsactualy holds a WebUserControl (.ascx) and those all inherit from abase control that defines and fires a common event when somethingchanges. This works. I debugged the event firing and it works justfine. The problem is that when i created Triggers and defined thecontrols that fire them and the common event nothing really happens.All those UpdatePanel's have their Mode set to Always so they did getupdated even before i added triggers with a small problem that they gotupdate after two clicks, thous showing what should have been shown oneclick back. Triggers actualy made no diference even dough I thoughtthey would.

If anybody has had the same problem and havesessed it please post your solutions. Should the UpdatePanles havetheir Mode set to Partial in order for triggers to work?

Last time I saw this "one-update-behind rendering" problem (for lack of a better term), it was a bug on my side; I was updating the data too late in the page lifecycle (so the UI had already been rendered).

A simple test to see if you have the same bug would be to take Atlas out of the equation. (Probably setting EnablePartialRendering="false" on your atlas:ScriptManager should be enough.) If the problem is still there when using normal postbacks, then you know that Atlas isn't the problem. On the other hand, if it starts working just like you'd expect (but full page refreshes, of course), then you know it's somehow related to Atlas.

As always, the best way to get help would be to create a really minimal Atlas app that demonstrates the problem and post the full code. That way other people can read through it and even try it on their own.


Hi Steve,

I tested Atlas behavior with creating a test project with one page (no master page). Then i created 2 web user controls (.ascx), added 2 UpdatePanels to the page and within each one I placed one of those user controls. Each user control contains a button which increments its number of clicks and the oposite control displays that number.

This composition works well if i set the UpdatePanels mode to Always - the user controls displays the correct number. If I set the mode to Conditional, the control - as expected - gets updated only when one of its contained controls has coused postback.

Next i tested adding Triggers to each of the UpdatePanels and link the controlId to oposite user control button and event name to click event. And afcourse setting the mode to Conditional. This also works very well.

Then I added events to controls themselfs. When the button within the control is clicked that event gets fired from the button click handler. And the user control event is then used as the target event in the UpdatePanel Trigger. Here is the problem. I am probably doing something wrong with page / user control as you suggested. Funny thing is this is a very simple page (no added code behind) and two very simple user controls. Each of user controls contains a method InnitializeControls() which sets the .Text property of the label. This method is called from Page_Load.

Is there some special way controls have to be written in order for Triggers and the Conditional Mode to work correctly? I would expect that trigger would update the panel after its target has finished initialization or after all other event handlers have finished. At what point are the triggers called? Should this involve any event bubbling?

Anyways, I need UpdatePanels to update based on user control event - the control is contained in another UpdatePanel. The problem can be fixed by explicitly setting the event handler to the publicly defined method in the control that needs to get updated when the event emiter changes. and setting the Mode to Always.

I hope there is a better way because this approach has a lot of overhead. I just don't get it why it works with buttons but not with user control events. Has this anything to do with client side clicks?

Thanks for any suggestions.