Use this optional tag if you want to bind a list-based control to a set of data. A good example would be providing the user with a drop down list of states (in the US) or a list of departments in a company or a list of job titles, etc. You can supply more than one <ControlDataSource> per form definition and you can use the <ControlDataSource> as the source for multiple controls within your form.
<ControlDataSource
CommandText="string"
ConnectionString="string"
Id="string"
Source="string">
Optionally add Parameter tags for any parameters you need
to send to the database.
<Parameter Name="string" Value="string" DataType="data type" />
...
</ControlDataSource>
<parameter> child tags. :[[Url:paramName]] or [[Portal:ID]], etc. For each control that will use the data, you need to specify:
<ControlDataSource> and serves to link the control to the data source.Back to top
<AddForm> <SelectCommand CommandText="SELECT @FirstName AS FirstName, @LastName AS LastName,
'AZ' AS StateId">
<Parameter Name="FirstName" Value='[[User:FirstName]]' DefaultValue=""/>
<Parameter Name="LastName" Value='[[User:LastName]]' DefaultValue="" />
</selectcommand> <SubmitCommand CommandText="INSERT INTO Users(FirstName,
LastName, StateId)
VALUES(@FirstName, @LastName, @StateId)" />
<ControlDataSource Id="dsStates" ConnectionString="(your connection string here)"
CommandText="SELECT StateName, StateId FROM States ORDER BY StateName ASC" /> <table> <tr>
<td>
<Label For="txtFirstName" Text="First Name" /> <TextBox Id="txtFirstName" DataField="FirstName"
DataType="string" /> </td> </tr> <tr>
<td>
<Label For="txtLastName" Text="Last Name" /> <Textbox Id="txtLastName" DataField="LastName" DataType="string" />
</td> </tr> <tr>
<td>
<Label For="ddlState" Text="State" />
<DropdownList Id="ddlState" DataField="StateId"
DataType="int32"
DatasourceId="dsStates" DataTextField="StateName" DataValueField="StateId"/>
</td>
</tr>
<tr>
<td colspan="2">
<AddButton Text="Add"/> <CancelButton Text="Cancel"/> </td> </tr> </table> <Email To="me@mysite.com" From="server@mysite.com" Subject="New User Added" Format="html">
A new user has been added:<br /> FirstName: [[FirstName]]<br />
LastName: [[LastName]] </Email></AddForm>