Hi -
My goal is to have a selection of one ComboBox populate a Selection in another ComboBox.
Example... Box 1 selection is Food, Box 2 selection would then have a collection of Food Items like cheese, bread or soda.
Here is my code:
The if statement and next line contain my problem.
I am used to using .SelectedValue with DDLs to select the Value, but with ComboBoxes it is not working. What do I use in place of .SelectedValue, or is it more complicated than that? I have read other posts pertaining to this and don't know which direction to take.
Thanks!!
wen
My goal is to have a selection of one ComboBox populate a Selection in another ComboBox.
Example... Box 1 selection is Food, Box 2 selection would then have a collection of Food Items like cheese, bread or soda.
Here is my code:
| RadPanelItem ProjectSearchItem = (RadPanelItem)RadPanelBar1.FindItemByValue("ProjectSearch"); |
| RadComboBox projectGroupRadComboBox = (RadComboBox)ProjectSearchItem.FindControl("projectGroupRadComboBox"); |
| IQueryable allProjectGroup = ProjectGroup.GetAllBindings(); |
| projectGroupRadComboBox.DataSource = allProjectGroup; |
| projectGroupRadComboBox.DataValueField = "ID"; |
| projectGroupRadComboBox.DataTextField = "Name"; |
| projectGroupRadComboBox.DataBind(); |
| projectGroupRadComboBox.Filter = RadComboBoxFilter.Contains; |
| if (projectGroupRadComboBox.SelectedValue != null && projectGroupRadComboBox.SelectedValue.Length > 0) |
| { |
| projectGroup = ProjectGroup.Get(Convert.ToInt32(projectGroupRadComboBox.SelectedValue)); |
| RadComboBox projectNameRadComboBox = (RadComboBox)ProjectSearchItem.FindControl("projectNameRadComboBox"); |
| IQueryable allProjectName = Project.GetAllBindings(projectGroup.DataModel.ID); |
| projectNameRadComboBox.DataSource = allProjectName; |
| projectNameRadComboBox.DataValueField = "ID"; |
| projectNameRadComboBox.DataTextField = "Name"; |
| projectNameRadComboBox.DataBind(); |
| projectNameRadComboBox.Filter = RadComboBoxFilter.Contains; |
| } |
| else |
| { |
| RadComboBox projectNameRadComboBox = (RadComboBox)ProjectSearchItem.FindControl("projectNameRadComboBox"); |
| IQueryable allProjectName = Project.GetAllBindings(null); |
| projectNameRadComboBox.DataSource = allProjectName; |
| projectNameRadComboBox.DataValueField = "ID"; |
| projectNameRadComboBox.DataTextField = "Name"; |
| projectNameRadComboBox.DataBind(); |
| projectNameRadComboBox.Filter = RadComboBoxFilter.Contains; |
| } |
The if statement and next line contain my problem.
I am used to using .SelectedValue with DDLs to select the Value, but with ComboBoxes it is not working. What do I use in place of .SelectedValue, or is it more complicated than that? I have read other posts pertaining to this and don't know which direction to take.
Thanks!!
wen