Dear Telerik,
Kindly directme to solve the scenario of loading the combo box based on the value of the recentcombo selection. After initially loading the values to all combo’s, if I choosethe value of the first combo and do filtering the second combo should need tofill with the available values instead of binding the whole items from the DB.
I could see that the scenario is elaborated with the Telerikfiltering demo, but used the Sqldatasource and calls the Refresh method in orderto achieve the scenario.
protected void RefreshCombos() |
{ |
SqlDataSource2SqlDataSource2.SelectCommand = SqlDataSource2.SelectCommand + " WHERE " + RadGrid1.MasterTableView.FilterExpression.ToString(); |
SqlDataSource3SqlDataSource3.SelectCommand = SqlDataSource3.SelectCommand + " WHERE " + RadGrid1.MasterTableView.FilterExpression.ToString(); |
SqlDataSource4SqlDataSource4.SelectCommand = SqlDataSource4.SelectCommand + " WHERE " + RadGrid1.MasterTableView.FilterExpression.ToString(); |
RadGrid1.MasterTableView.Rebind(); |
} |
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
// Filter controls value binding |
if (e.Item.ItemType == GridItemType.FilteringItem) |
{ |
DataSet dsStates = null; |
RadTextBox txtName; |
txtName = (RadTextBox)e.Item.FindControl("txtName"); |
if (ViewState["txtName"] != null) |
{ |
txtName.Text = ViewState["txtName"].ToString(); |
} |
RadComboBox StateComboBox; |
StateComboBox = (RadComboBox)e.Item.FindControl("StateComboBox"); |
sql = "sp_GetNames "; |
StateComboBox.ClearSelection(); |
StateComboBox.DataSource = dsStates.Tables[0]; |
StateComboBox.DataTextField = "State"; |
StateComboBox.DataValueField = "State"; |
StateComboBox.DataBind(); |
StateComboBox.Items.Insert(0, new RadComboBoxItem(" All ", " All ")); |
StateComboBox.SelectedIndex = 0; |
if (ViewState["txtState"] != null) |
{ |
StateComboBox.FindItemByText(ViewState["txtState"].ToString()).Selected = true; |
} |
protected void StateComboBox_IndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) |
{ |
//Code for customized server side filtering |
string filterState = ""; |
if (e.Text.Trim() != "All") |
{ |
filterState = "([State] = '" + e.Text + "')"; |
} |
else |
{ |
filterState = "([State] <> '')"; |
} |
ViewState["txtState"] = e.Text.ToString(); |
vwState = filterState; |
if (vwGroupID != null) |
{ |
filterState += " And " + vwGroupID; |
} |
//Calling FilterExpression finally |
RadGrid1.MasterTableView.FilterExpression = filterState; |
RadGrid1.MasterTableView.Rebind(); |
} |
I could not find the best way to do the scenario with dynamicallycreated combo as it is achieved in Telerik demo for filtering
Thanks and looking forward for yours ideas