Products and Services
Graffiti CMS
Learn more about our simple content publishing platform.
Harvest Reporting Server
Get business intelligence tools for measuring online behavior.
Professional Services
Consulting, creative, and Web services from the people who know Community Server best.
Solutions
Telligent
Learn more about our team at Telligent.com.
 

Action Controls

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:

  • ExecuteScriptAction (<CSControl:ExecuteScriptAction />) – Executes the javascript specified by the script property.
  • GoToCurrentContentAction (<CSControl:GoToCurrentContentAction />)Navigates
    to view the current content object, if a content object exists in the current context.
  • GoToCurrentPostAction (<CSControl:GoToCurrentPostAction />)Navigates to view the current post if a post exists in the current context.
  • GoToModifiedUrlAction (<CSControl:GoToModifiedUrlAction />) - Applies the specified query string (QueryStringModification property) and target (TargetLocationModification property) modifications to the current URL and navigate to the resulting modified URL.
  • GoToReferralUrlAction (<CSControl:GoToReferralUrlAction />)- Navigates to the referral URL as specified on the query string if a referral URL exists.
  • GoToSiteUrlAction (<CSControl:GoToSiteUrlAction />) - Navigates to the specified URL from the SiteUrls.config file as defined by the UrlName. 
  • SetVisibilityAction (<CSControl:SetVisibilityAction />) - Sets the controls identified by its ControlIdsToShow property to visible (Visible = true) and sets the controls identified by its ControlIdsToHide property to hidden (Visible = false).  Both lists are comma-separated.
  • CustomAction (<CSControl:CustomAction />) – Adds support for code-based actions by exposing an event, CustomEvent, which can be used to implement inline code. The CustomEvent is passed a reference to the parent control executing the event as well as the parent control's parameter (which is control-specific). For example, The following script executes the custom code within the MyCustomEventHandler method defined on the page:

<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" />

  • Actions (<CSControl:Actions />) - Executes a set of sub-actions. The "SuccessActions" inner-property on the <CSBlog:ContactForm /> example above is an Actions control.

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.