dWebSpec Dictionary
CONTEXT: descriptors->segment->event-id




All Details Standard Only Platform Only
Structured Web info and helpTechnologies
 Home Page
 Product Page
 Download Page
 Feedback
Javascript Tree Menu

Results for:

 segment.event-id 
Prev  Topic  Next

This attribute is used along with dynamic-include, in that a dynamic include might involve a static page or page that result from dynamic event. Static page would be designated with the value attribute, whereas the event generated page would require and event-id.

The AJAX refreshed segment would also be associated with an event of the ajax type. An event would be associated here, whereas the event would carry the ajax option.

 ASP.NET  
Whenever there is an event-id associated with a segment, and the related event has a call-type of ajax, the implication is that partial re-rendering is required.

A normal inline segment would show in the source content as shown below.

  <!--aws:segment id="actionEqualNew" -->
   . . . . Code for Create . . . .
  <!--/aws:segment -->
Without an association with AJAX event, this would be implemented as show here.
<asp:Panel id="actionEqualNew" runat="server" Visible="<%# Action=='NEW'>">
. . . . Code for Create . . . .
</asp:Panel>

The descriptor entries could associate such panel with AJAX event.

The specification for the associated event is as follows.

EVENT DESCRIPTORS

id

event-source

parameters

handler

handler-class

security

call-type

5 forms[main].elements[Button1].onClick   {bb.Button1_Click}     ajax

The source element for the event would be represented in the element descriptor. The segment to be re-rendered must also be demarcated in the segment descriptor, with the link to the AJAX event (event-id).

SEGMENT DESCRIPTORS

id

type

visible

enable

valuue

base-page-id

extends

event-id

description

UpdatePanel1 inline           5  

These elements and segment are shown in the source content below. The implementation is shown below.

<body>
<form id="form1" runat="server">
  <asp:ScriptManager EnablePartialRendering="true" ID="ScriptManager1"
             runat="server"></asp:ScriptManager>
        <div>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server"
                 ChildrenAsTriggers="true">
                <ContentTemplate>
                    <asp:Label ID="Label1" runat="server"
                        Text="This is a label!"></asp:Label>
                    <asp:Button ID="Button1" runat="server" Text="Click Me"
                        OnClick="Button1_Click" />
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
</form>
</body>

As shown in the code snippet above, the UpdatePanel control is the panel control that allows partial re-rendering. The content of such panel would be the subject of re-rendering.

ScriptManager

The UpdatePanel control requires a ScriptManager control on the Web page. EnablePartialRendering property of the ScriptManager control is set to true, which is the default. This implies that partial-page updates are enabled.

Content

The content of the UpdatePanel must be enclosed in the <ContentTemplate> element.

Triggers

To allow as little modification as possible, by default, any postback control inside an UpdatePanel control causes an asynchronous postback and refreshes the panel's content. This is enabled by setting the ChildrenAsTriggers property to true.

It is the updateMode property of the UpdatePanel that could widen or restrict the possible trigger for partial update on the page, by setting the updateMode to ?always?; or restricting this list, by setting the value to ?conditionally?. This is described farther below:

UpdateMode: Always
All postback and asynchronous postback originating from the page would trigger an update of the UpdatePanel control?s content. This is not meant to be used with the ChildrenAsTriggers attribute set to true. The latter is meant to be used with the finer grain UpdateMode set to "conditional".

UpdateMode: Conditional
This restricts the update to these conditions.

When the ChildrenAsTriggers property is set to true, any child control of the UpdatePanel control causes a postback.

Additionally, the postback could be initiated by a trigger defined for that UpdatePanel control; the definition of such triggers is discussed below.

As discussed above, the update could be invoked through regular postback or any asynchronous trigger on the page, when the Update mode is set to "Always". Or else, a finer control could be in use, by setting the UpdateMode to conditional. With the latter, apart from using children control as triggers automatically, triggers could be defined explicitly, either on the target UpdatePanel or elsewhere on the page. A trigger is a definition that specifies which postback control and event cause a panel to be partially updated.

The triggers are included declaratively using markup; this is done within the <triggers> section of the UpdatePanel control declaration. The <Triggers> element can contain any number of the <asp:AsyncPostBackTrigger> and <asp:PostBackTrigger> definitions. They both accept two attributes, ControlID and EventName, and can specify any Control within the current encapsulation (For instance, you could not reference controls outside the current user control). If an event is not specified, the trigger event is the default event of the control. For example, for a Button control, the default is the Click event.

Tag

Description

<asp:AsyncPostBackTrigger>

Specifies a control and event that will cause a partial page update for the UpdatePanel that contains this trigger reference.

<asp:PostBackTrigger>

Specifies a control and event that will cause a full page update (a full page refresh). This tag can be used to force a full refresh when a control would otherwise trigger partial rendering

Additional explanation on the two trigger option is usually necessary; the clarifications are as follows.

Normally, controls outside of an update panel will trigger a normal synchronous post back.?This is the normal for controls without AJAX or asynchronous call being in play. The AsyncPostBackTrigger ?wires? up these controls to trigger an asynchronous post back.

Controls declared inside an update panel will trigger an asynchronous call by default when ChildrenAsTriggers property is set to true.? With this attribute set false, controls within the update panel could be set up for asynchronous update with the AsyncPostBackTrigger. The PostBackTrigger short circuits this, and forces the control to do a synchronous post back.

Prev Next