Action controls define a single function or behavior that can be invoked by other Chameleon controls when configurable events occur.
Action controls are generally used when a Chameleon form control completes a processing event, such as the successful submission of a blog contact form. Here is an example:
<CSBlog:ContactForm runat="server" SubjectTextBoxId="Subject" NameTextBoxId="Name" EmailTextBoxId="Email" MessageTextBoxId="Body" SubmitButtonId="Submit">
<SuccessActions>
<CSControl:SetVisibilityAction runat="server" ControlIdsToShow="SuccessMessage" />
</SuccessActions>
<FormTemplate>
<div><CSControl:FormLabel LabelForId="Name" runat="server" ResourceName="Weblog_ContactForm_Name" /></div>
<div><asp:TextBox id="Name" runat="server" /></div>
<div><CSControl:FormLabel LabelForId="Email" runat="server" ResourceName="Weblog_ContactForm_Email" /></div>
<div><asp:TextBox id="Email" runat="server" /></div>
<div><CSControl:FormLabel LabelForId="Subject" runat="server" ResourceName="Weblog_ContactForm_Subject" /></div>
<div><asp:TextBox id="Subject" runat="server" /></div>
<div><CSControl:FormLabel LabelForId="Body" runat="server" ResourceName="Weblog_ContactForm_Body" /></div>
<div><asp:TextBox id="Body" runat="server" TextMode="MultiLine" /></div>
<div>
<asp:Button id="Submit" runat="server" Text="Send" />
<CSControl:ResourceControl runat="Server" id="SuccessMessage" ResourceName="Weblog_ContactForm_Sent" Visible="false" />
</div>
</FormTemplate>
</CSBlog:ContactForm>
The example above uses the <CSControl:SetVisibilityAction /> action control to ensure that the control with ID "SuccessMessage" should have its Visibility property set to true when the <CSBlog:ContactForm /> is successfully submitted.
There are many controls defined within Community Server and you can define new ones. (All Action controls inherit from ActionBase). Existing action controls include:
<script runat="server" language="C#">
protected void MyCustomEventHandler(System.Web.UI.Control sender, object parameter)
{
// custom code here
}
</script>
<CSControl:CustomAction runat="server" CustomEvent="MyCustomEventHandler" />
More than one action control can be used. Community Server executes actions in the order they are defined so. For example, the following script will first attempt to navigate to the referral URL as specified on the querystring. If no referral URL is defined, the "SuccessMessage" control will be made visible.
<SuccessActions>
<CSControl:GoToReferralUrlAction runat="server" />
<CSControl:SetVisibilityAction runat="server" ControlIdsToShow="SuccessMessage" />
</SuccessActions>
Action controls provide a mechanism that allows theme developers to customize the behavior of forms. Theme developers can implement custom navigation and notification behaviors specific to the needs of their themes.