Posted 16 May 2013 Link to this post
<
td
>
telerik:RadComboBox
ID
=
"cboAccount"
runat
"server"
DataTextField
"AccountName"
DataValueField
"AccountID"
EnableLoadOnDemand
"True"
EmptyMessage
"Select Account"
MarkFirstMatch
OnSelectedIndexChanged
"cboAccount_SelectedIndexChanged"
AutoPostBack
</
asp:RequiredFieldValidator
"ValidateAccount"
ControlToValidate
ErrorMessage
"Please select a value"
></
"RadComboBox1"
"true"
OnItemsRequested
"RadComboBox1_ItemsRequested"
"Select Country"
"RadComboBox1_SelectedIndexChanged"
"Select a Country"
br
/>
"RadComboBox2"
Width
"186px"
asp:SqlDataSource
"SqlDataSource2"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT Name FROM [Country] ORDER By Name"></
telerik:RadButton
"RadButton1"
Text
"Click"
CausesValidation
protected
void
RadComboBox1_ItemsRequested(
object
o, RadComboBoxItemsRequestedEventArgs e)
{
RadComboBox1.DataSourceID =
;
RadComboBox1.DataTextField =
"Name"
RadComboBox1.DataBind();
}
RadComboBox1_SelectedIndexChanged(
sender, RadComboBoxSelectedIndexChangedEventArgs e)
LoadCities(e.Text);
LoadCities(
string
countryName)
SqlConnection connection =
new
SqlConnection(
ConfigurationManager.ConnectionStrings[
"NorthwindConnectionString"
].ConnectionString);
SqlDataAdapter adapter =
SqlDataAdapter(
"SELECT * FROM City WHERE Countryname in ('"
+ countryName +
"') ORDER By Countryname,Cityname"
, connection);
DataTable dt =
DataTable();
adapter.Fill(dt);
RadComboBox2.DataTextField =
"Cityname"
RadComboBox2.DataSource = dt;
RadComboBox2.DataBind();