i've been able to populate the radFilter on page load very effectively up to this point. i'm using a .xml file to set the FieldEditor with both
TextFieldEditors & DateFieldEditors. i ran into trouble however when i had the need to do this for
RadFilterComboxEditors. the problem, i think is populating the comboBox Control itself.
the "
dd_workordertypes_nonstorage" reference below is basically the query. that will come back as:
Value || Display
1 Plant
2 Mobile
3 Coating
i know i'm missing something somewhere and i've read most of the examples in the forums - but can't really find anything that is specifically like this, so any direct tips for the code below would help me out greatly.
thx
rik
protected void readXMLSearch(string xmlFile)
{
string myPath = Server.MapPath("DynReportXml\\" + xmlFile + ".xml");
DataSet ds = new DataSet();
DataTable dt = new DataTable();
try
{
ds.ReadXml(myPath);
dt = ds.Tables[0];
foreach (DataRow aRow in dt.Rows)
{
RadFilterTextFieldEditor editor = new RadFilterTextFieldEditor();
RadFilterDateFieldEditor dateEditor = new RadFilterDateFieldEditor();
RadFilterComboBoxEditor comboEditor = new RadFilterComboBoxEditor();
string myType = (string)aRow["dataType"];
string myComboSearch = "";
myComboSearch = (
string)aRow["custom"];//Reads xml file for combobox search query
if (myType == "datetime")
{
RepLauncherRadFilter.FieldEditors.Add(dateEditor);
//calendar
dateEditor.FieldName = (
string)aRow["dbColumn"];
dateEditor.DisplayName = (
string)aRow["display"];
}
else if (myType != "datetime" & myComboSearch == "NA")
{
RepLauncherRadFilter.FieldEditors.Add(editor);
//TextBox
editor.FieldName = (
string)aRow["dbColumn"];
editor.DisplayName = (
string)aRow["display"];
}
else if (myType != "datetime" & myComboSearch == "dd_workordertypes_nonstorage")
{
RepLauncherRadFilter.FieldEditors.Add(comboEditor);
//comboBox
comboEditor.FieldName = (
string)aRow["dbColumn"];
comboEditor.DisplayName = (
string)aRow["display"];
using (UtilitiesBC ubc = new UtilitiesBC())
{
DataTable comboDt = ubc.ddForDynamic(DivisionID.ToString(), myComboSearch);
RadComboBox _comboBox = new RadComboBox();
_comboBox.DataSourceID = comboEditor.DataSourceID;
comboEditor.DataValueField = _comboBox.DataValueField;
comboEditor.DataTextField = _comboBox.DataTextField;
_comboBox.DataSource = comboDt.DefaultView;
_comboBox.DataValueField =
"VALUE";
_comboBox.DataTextField =
"DISPLAY";
_comboBox.DataBind();
}
}
}
}
catch (Exception ex)
{
string myEx = ex.ToString();
}
}