protected void dataSources_ItemDataBound(object sender, RepeaterItemEventArgs e) { DropDownList dataSourcesDropDownList = e.Item.FindControl("dataSourcesDropDownList") as DropDownList; if (dataSourcesDropDownList != null) { KeyInitialValueModel argumentModel = (KeyInitialValueModel)e.Item.DataItem; dataSourcesDropDownList.DataSource = Model.DataSources; dataSourcesDropDownList.DataBind(); bool didSet = false; if (argumentModel.InitialValue != null) { dataSourcesDropDownList.SelectedValue = argumentModel.InitialValue; didSet = (dataSourcesDropDownList.SelectedValue == argumentModel.InitialValue); } if (!didSet) { dataSourcesDropDownList.Items.Insert(0, NOT_SELECTED_TEXT); dataSourcesDropDownList.SelectedIndex = 0; } if (_disableRepeaterEditing) { dataSourcesDropDownList.Enabled = false; } } }
protected void argsRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e) { DropDownList argGlobalValueDropDownList = e.Item.FindControl("argGlobalValueDropDownList") as DropDownList; if (argGlobalValueDropDownList != null) { argGlobalValueDropDownList.DataSource = Model.GlobalArgs; argGlobalValueDropDownList.DataBind(); argGlobalValueDropDownList.Items.Insert(0, NOT_SELECTED_TEXT); argGlobalValueDropDownList.SelectedIndex = 0; } TextBox argValueEdit = e.Item.FindControl("argValueEdit") as TextBox; KeyInitialValueModel argumentModel = (KeyInitialValueModel)e.Item.DataItem; CheckBox checkBox = e.Item.FindControl("globalValueCheckBox") as CheckBox; bool isGlobalArg = ((argumentModel.InitialValue != null) && argumentModel.InitialValue.StartsWith(ConfigItem.GLOBAL_ARG_INDICATOR)); if (isGlobalArg) { if (checkBox != null) { checkBox.Checked = true; } if (argValueEdit != null) { argValueEdit.Visible = false; } if (argGlobalValueDropDownList != null) { argGlobalValueDropDownList.Visible = true; string globalArg = argumentModel.InitialValue.Substring(1); argGlobalValueDropDownList.SelectedValue = globalArg; if (argGlobalValueDropDownList.SelectedValue == globalArg) { argGlobalValueDropDownList.Items.RemoveAt(0); } } } else { if (checkBox != null) { checkBox.Checked = false; } if (argValueEdit != null) { argValueEdit.Visible = true; if (argumentModel.InitialValue != null) { argValueEdit.Text = argumentModel.InitialValue; } } if (argGlobalValueDropDownList != null) { argGlobalValueDropDownList.Visible = false; } } if (_disableRepeaterEditing) { argGlobalValueDropDownList.Enabled = false; argValueEdit.Enabled = false; checkBox.Enabled = false; } }