Groups > Asp .Net > ASP.NET Atlas Framework discussion > Re: understanding triggers




understanding triggers

understanding triggers
Tue, 26 Sep 2006 09:23:32 +000
I have two updatePanels on my web page. Both are completely independant of each
other, different parts of teh application. However, whenever I hit a button in
one updatePanel both updatePanels get updated, both progrees templates display
my "loading.." text  even though only one was updatePanel was
submitted.

So, having heard about triggers, I thought they must surely be the answer.
However, having set the mode="conditional" on both updatePanels adn
defined controlEventTriggers based on my buttons - I still get this unwanted
re-rendering of all panels. I am beginning to think that I have completely
misunderstood what triggers are all about??

Here is a simplified version of my code, a demo page that behaves exactly as I
descibed. Any help here much appreciated.

 

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

<div>

<atlas:ScriptManagerID="ScriptManager1"runat="server"Enab
lePartialRendering="True">

</atlas:ScriptManager>

<br/>

PANEL 1</div>

<atlas:UpdatePanelID="UpdatePanel1"runat="server"Mode=&qu
ot;Conditional">

<ContentTemplate>

<asp:TextBoxID="TextBox1"runat="server"></asp:TextB
ox>

<asp:ButtonID="Button1"runat="server"OnClick="Button
1_Click"Text="Button"/><br/>

<asp:LabelID="Label1"runat="server"Text="Label"
></asp:Label>

<atlas:UpdateProgressID="UpdateProgress1"runat="server"&g
t;

<ProgressTemplate>

Contacting server...

<br/>

<br/>

<inputid="abortButton"runat="server"type="button&quo
t;value="Abort Request"/>

</ProgressTemplate>

</atlas:UpdateProgress>

</ContentTemplate>

<Triggers>

<atlas:ControlEventTriggerControlID="Button1"EventName="Click&
quot;/>

</Triggers>

</atlas:UpdatePanel>

<br/>

<br/>

PANEL 2<br/>

<atlas:UpdatePanelID="UpdatePanel2"runat="server"Mode=&qu
ot;Conditional">

<ContentTemplate>

&nbsp;<asp:TextBoxID="TextBox2"runat="server"><
/asp:TextBox>

<asp:ButtonID="Button2"runat="server"OnClick="Button
2_Click"Text="Button"/>

<br/>

<asp:LabelID="Label2"runat="server"Text="Label"
></asp:Label>

<atlas:UpdateProgressID="UpdateProgress2"runat="server"&g
t;

<ProgressTemplate>

Contacting server...

<br/>

<br/>

<inputid="abortButton"runat="server"type="button&quo
t;value="Abort Request"/>

</ProgressTemplate>

</atlas:UpdateProgress>

</ContentTemplate>

<Triggers>

<atlas:ControlEventTriggerControlID="Button2"EventName="Click&
quot;/>

</Triggers>

</atlas:UpdatePanel>

</form>
Post Reply
Re: understanding triggers
Tue, 26 Sep 2006 11:17:10 +000
Hi,

to clarify:

1) Triggers should reference server controls dropped outside an UpdatePanel,
because every server control inside an UpdatePanel fires a partial postback.

2) It's correct to set Mode="Conditional" to prevent all the
UpdatePanels to update at the same time.

3) You can have only an UpdateProgress control in the page. In other terms,
there's no way at the moment to map an UpdateProgress control to a particular
UpdatePanel. This means that if you declare multiple UpdateProgress controls,
they will be all displayed during a partial postback.

In your case, the UpdatePanels are updating correctly (one at a time) but both
the UpdateProgress controls are displayed.
Post Reply
Re: understanding triggers
Tue, 26 Sep 2006 14:15:03 +000
Great, thanks for the response. Yes, I had just determined that no actual server
side activity was happening, just the UpdateProgress display kicing in for all
controls.

re:  there's no way at the moment to map an UpdateProgress control to a
particular UpdatePanel

That kind of sucks - in at least 2 places I simply have to abandon Atlas if this
is the case. In my current app it is not so bad as my various UpdatePanels are
inside of an Accordion control, therefore any redundant UpdateProgress display
is hidden away.

Is there no way to plug into the javascript to tell the unwanted
UpdateProgress's to keep quiet!? Perhaps just wrap a id'd div around the
updateProgress template in question,  and onClick hide it??  (Will try
tommorow)

 Thanks again
Post Reply
Re: understanding triggers
Wed, 27 Sep 2006 19:14:51 +000
Again, Luis is spot on :)

To add another comment about UpdateProgress:

In the CTP there's no point to having more than one per page since it just says
that "something" is going on, regardless of who or what or why. In
Atlas 1.0 we'll have the necessary plumbing so that a new UpdateProgress control
could show different text/images depending on what caused the update. It's
important to realize that on the client it's impossible for us to know what's
going to get updated since that logic is all on the server. We could only know
what gets updated once the response from the server comes back, at which point
it doesn't matter anyway.

The new piece of functionality we'll have is an event that tells you
specifically which DOM element caused the postback. Beyond that it's up to
someone else to determine what that "means" (e.g. was it a button
click inside a GridView? Or a Wizard? Or just a regular LinkButton by itself?).

Thanks,

Eilon
Post Reply
Re: understanding triggers
Wed, 27 Sep 2006 19:28:41 +000
hello.

hum...this time i didn't do anything :D

 btw, any chance of adding a public property to the pagerequestmanager that lets
us access the postback settings of the current partial postback?
Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact