<xmod:CommandLink>

The CommandLink tag renders as a hyperlink at run-time. It is used to execute data commands in another template within the module instance. For instance, if you had two templates, you might put a CommandLink in template #1 to pass a parameter to the <listdatasource> of template #2, causing that template to re-load with the new result set.

Syntax

<xmod:CommandLink
    BackColor="color name|#dddddd"
    BorderColor="color name|#dddddd"
    BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge| Inset|Outset"
    BorderWidth="size"
    CssClass="string"
    Font-Bold="True|False"
    Font-Italic="True|False"
    Font-Names="string"
    Font-Overline="True|False"
    Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium| Large|X-Large|XX-Large"
    Font-Strikeout="True|False"
    Font-Underline="True|False"
    ForeColor="color name|#dddddd"
    Height="size"
    OnClientClick="javascript"
    Style="string"
    Text="string"
    ToolTip="string"
    Visible="True|False"
    Width="size">
 
    
    <Command Target="string" Type="List|Detail">
        <Parameter Name="string" Value="string" />
        <Parameter Name="string" Value="string" />
        additional parameters as needed ...
    </Command>
    additional commands as needed ...
</xmod:CommandLink>

Remarks

Back to top

Example

<div>
  <table width="100%">
    <tr>
      <td colspan="2">
        <!-- DEPARTMENTS TEMPLATE -->
        <xmod:template id="Departments">
          <listdatasource commandtext="SELECT DepartmentId, DepartmentName FROM XMPDemo_Departments ORDER BY DepartmentName" />
          <itemtemplate>
            <xmod:commandlink text='[[DepartmentName]]'>
              <command target="Employees" type="list">
                <parameter name="DepartmentId" value='[[DepartmentId]]' />
              </command>
              <command target="EmployeeProfile" type="detail">
                <parameter name="EmployeeId" value="-1"/>
              </command>
            </xmod:commandlink>&nbsp;
          </itemtemplate>
        </xmod:template>
      </td>
    <tr>
      <td width="250" valign="top">
        <!-- EMPLOYEES TEMPLATE -->
        <xmod:template id="Employees">
          <listdatasource commandtext="SELECT * FROM XMPDemo_Employees WHERE DepartmentId = @DepartmentId">
           <parameter name="DepartmentId" alias="DepartmentId"/>
         </listdatasource>
         
<headertemplate>
            <p>Employees</p>
          </headertemplate>
          <itemtemplate>
            <div style="text-align: middle;">
              <xmod:commandimage text="Profile" imageurl="~/images/icon_hostusers_32px.gif" imagealign="absmiddle">
                <command type="detail" target="EmployeeProfile">
                  <parameter name="EmployeeId" value='[[EmployeeId]]' />
                </command>
              </xmod:commandimage> &nbsp;<strong>[[FirstName]] [[LastName]]</strong>
            </div>
          </itemtemplate>
        </xmod:template>
      </td>
      <td width="500" valign="top">
        <!-- EMPLOYEE PROFILE TEMPLATE -->
        <xmod:template id="EmployeeProfile">
          <detaildatasource commandtext="SELECT * FROM XMPDemo_Employees WHERE EmployeeId = @EmployeeId">
            <parameter name="EmployeeId" alias="EmployeeId" value="-1"/>
          </detaildatasource>
          <detailtemplate>
            <h1>Employee Profile</h2>
            <p style="font-size: 14px; font-weight: bold;">[[FirstName]] [[LastName]]</p>
            <p style="font-size: 12px; font-weight: bold;"><em>[[JobTitle]]</em></p>
            <p>[[Resume]]</p>
          </detailtemplate>
        </xmod:template>
      </td>
    </tr>
  </table>
</div>
 
Back to top