Hi,
I have a user control which has several RadComboBoxes with CheckBoxes set to True.
Some of these combo boxes have cascading datasources and have TextChanged events so when the user changes what items are checked it will re-bind the relevant controls that use this selection.
On the page I have a standard ASP.NET button which gets the values from these combo boxes and updates a chart and table etc. When this button is clicked it is triggering the TextChanged events of the combo boxes which is making the combo boxes think nothing is selected when you can physically see items checked.
I have four combo boxes, ddlProject, ddlUnit, ddlDiscipline and ddlDocType. ddlProject binds unit, discipline and doc type and unit/discipline update doc type. Values don't need to be selected for these for the datasource as if there are no selected items then the SQL statements ignores this in the where clause.
If I don't select anything in unit or discipline there ddlDocType still binds and I can select items but when I click my button the TextChanged events fire and the CheckedItems for ddlDocType is 0. If I have items selected in unit and discipline CheckItems for ddlDocType gives the correct number.
This is the structure of the combo boxes
This is an example of the OnTextChanged event
My user control has methods to make the selected items accessible such as :
I've been looking at this for quite a while now trying to figure out why the Telerik control events are being fired when I click the button and why the ddlDocType CheckedItems is bringing back nothing when nothing is selected in Unit/Discipline.
Can anyone help?
I have a user control which has several RadComboBoxes with CheckBoxes set to True.
Some of these combo boxes have cascading datasources and have TextChanged events so when the user changes what items are checked it will re-bind the relevant controls that use this selection.
On the page I have a standard ASP.NET button which gets the values from these combo boxes and updates a chart and table etc. When this button is clicked it is triggering the TextChanged events of the combo boxes which is making the combo boxes think nothing is selected when you can physically see items checked.
I have four combo boxes, ddlProject, ddlUnit, ddlDiscipline and ddlDocType. ddlProject binds unit, discipline and doc type and unit/discipline update doc type. Values don't need to be selected for these for the datasource as if there are no selected items then the SQL statements ignores this in the where clause.
If I don't select anything in unit or discipline there ddlDocType still binds and I can select items but when I click my button the TextChanged events fire and the CheckedItems for ddlDocType is 0. If I have items selected in unit and discipline CheckItems for ddlDocType gives the correct number.
This is the structure of the combo boxes
<
telerik:RadComboBox
ID
=
"ddlUnit"
runat
=
"server"
CheckBoxes
=
"true"
EnableCheckAllItemsCheckBox
=
"true"
MaxHeight
=
"450px"
Width
=
"300px"
DataTextField
=
"Value"
DataValueField
=
"Key"
Label
=
"Unit:"
LabelCssClass
=
"HeaderLabel"
DropDownWidth
=
"600px"
Height
=
"400px"
AutoPostBack
=
"true"
OnTextChanged
=
"ddlUnit_TextChanged"
>
</
telerik:RadComboBox
>
This is an example of the OnTextChanged event
protected
void
ddlDiscipline_TextChanged(
object
sender, EventArgs e)
{
CTRmDataService ctrmDS =
new
CTRmDataService();
this
.ddlDocType.DataSource = ctrmDS.GetDocumentTypesForProjectsDisciplineAndUnit(GetSelectedProjects(),
GetSelectedDisciplines(),
GetSelectedUnits(),
LoggedOnUser.Id);
this
.ddlDocType.DataBind();
}
My user control has methods to make the selected items accessible such as :
public
string
[] GetSelectedDocTypes()
{
return
ddlDocType.CheckItems.Where(x => x.Value !=
"PSP"
)
.Select(v => v.Value).ToArray<
string
>();
}
I've been looking at this for quite a while now trying to figure out why the Telerik control events are being fired when I click the button and why the ddlDocType CheckedItems is bringing back nothing when nothing is selected in Unit/Discipline.
Can anyone help?