

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
Hi
I amhaving radgrid which has NestedGrid also. I would like to see my row is beingselected when invoking edit and close the editpopup window. So that the clientcan be known what row is selected after coming back from updating or closingthe PopUp window?
I used the below scenarios, it is working fine with singlegrid. But in nested grid suppose I expanded two parent items in order to edittheir child items. I could not able to save the state of row after theoperation has been done.
| if (e.Item is GridEditableItem && e.Item.IsInEditMode) |
| { |
| if (!e.Item.OwnerTableView.IsItemInserted) |
| { |
| Session["selIndex"] = e.Item.ItemIndex; |
| } |
| e.Item.Selected = true; |
| isSelected = true; |
| } |
| protected void RadChild1_PreRender(object sender, EventArgs e) |
| { |
| if (!isSelected && Session["selIndex"] != null) |
| { |
| RadChild1.MasterTableView.Items[(int)Session["selIndex"]].Selected = true; |
| Session["selIndex"] = null; |
| } |
| isSelected = false; |
| } |