Showing posts with label valuetrigger. Show all posts
Showing posts with label valuetrigger. Show all posts

Saturday, March 24, 2012

Triggers

Can you provide a short example, or point me in the direction, of how to use the "ControlEventTrigger" - I think I have the "Control ValueTrigger" figured out - responds to a value of a control changing (right?), but I'm not sure how the EventTrigger is used - I assume it responds to an event...

Thanks,


Ed

Here is an example. The supervisor dropdown gets updated once a manager is chosen.

<asp:DropDownListID="ddlManager"runat="server"DataSourceID="odsManager"DataTextField="Manager"DataValueField="ManagerID"AutoPostBack="True"></asp:DropDownList>

<atlas:UpdatePanelID="p2"runat="server"Mode="Conditional">

<ContentTemplate>

<asp:DropDownListID="ddlSupervisor"runat="server"DataSourceID="odsSupervisor"

DataTextField="Supervisor"DataValueField="Supervisor">
</asp:DropDownList>

</ContentTemplate>

<Triggers>

<atlas:ControlEventTriggerControlID="ddlManager"EventName="SelectedIndexChanged"/> </Triggers>

</atlas:UpdatePanel>


A sample of using ControlEventTrigger is included in the ASP.Net Atlas First Look webcast (Nikhil Kothari)

Download ASP.NET "Atlas" First Look demo video

Hope this helps...


Thank you Nta and dip!
Hi,

what is the magic behind a ControlEventTrigger? well, suppose that you are using the SelectedIndexChanged event of a DropDownList as a trigger, like in the example posted by Nta.

What the trigger does is attaching an event handler to the SelectedIndexChanged event. When you make a selection in the ddl, the ddl does a postback, the SelectedIndexChanged event fires and the handler attached by the trigger is executed.

When the trigger's handler is executed, the corresponding UpdatePanel is forced to perform an update.