protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e) { if ((e.Item is GridEditFormItem) && e.Item.IsInEditMode) { GridEditFormItem gridEditFormItem = (GridEditFormItem)e.Item; DropDownList dropDownList = (DropDownList)gridEditFormItem.FindControl("ddlPickSIPScheme"); HtmlTableRow trSchemeDDL = (HtmlTableRow)gridEditFormItem.FindControl("trSchemeNameDDL"); HtmlTableRow trSchemeTextBox = (HtmlTableRow)gridEditFormItem.FindControl("trSchemeNameText"); //TextBox txt = (TextBox)gridEditFormItem.FindControl("txtUnits"); //txt.Visible = false; if (e.Item.RowIndex == -1) { trSchemeDDL.Visible = true; trSchemeTextBox.Visible = false; BindDDLSIPSchemeAllocated(dropDownList); } else { trSchemeDDL.Visible = false; trSchemeTextBox.Visible = true; } } //if (e.Item is GridCommandItem) //{ // LinkButton refreshButton = e.Item.Controls[0].Controls[0].Controls[0].Controls[1].Controls[0] as LinkButton; // refreshButton.Visible = false; //} }
protected void rcbCarriers_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { RadComboBox combobox = (RadComboBox)sender; GridEditFormItem edititem = (GridEditFormItem)combobox.NamingContainer; RadTextBox rtb = (RadTextBox)edititem.FindControl("txtCageType"); RadListBox rlbFrom = (RadListBox)edititem.FindControl("RadListBoxFrom"); RadListBox rlbTo = (RadListBox)edititem.FindControl("RadListBoxTo"); Label lblCageType = (Label)edititem.FindControl("lblCageType"); RadTextBox txtCageType = (RadTextBox)edititem.FindControl("txtCageType"); rlbFrom.Items.Clear(); if (combobox.SelectedValue == "-1") { rlbFrom.Items.Clear(); } else { CagetypeServiceDAO cts = new CagetypeServiceDAO(); DataTable dtServices = cts.GetCarrierServices(combobox.SelectedValue).Tables[0]; foreach (DataRow dr in dtServices.Rows) { rlbFrom.Items.Add(new RadListBoxItem(dr["carrier_service_descr"] as string, dr["carrier_service_id"] as string)); } } }
protected void trolleyclass_type_RadComboBox_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { RadComboBox combobox = (RadComboBox)sender; GridEditFormItem edititem = (GridEditFormItem)combobox.NamingContainer; if (combobox.SelectedValue == "3") { // trolley type drop down TrolleyDAO trolleydao = new TrolleyDAO(); DataSet trolleyCodes = new DataSet(); trolleyCodes = trolleydao.GetCodesByType(); RadComboBox trolleytype = (RadComboBox)edititem .FindControl("trolleytype_RadComboBox"); trolleytype.DataSource = trolleyCodes.Tables["TT"]; trolleytype.DataTextField = "type_short_name"; trolleytype.DataValueField = "type_id"; trolleytype.DataBind(); trolleytype.Items.Insert(0, new RadComboBoxItem("", "0")); trolleytype.Visible = true; RequiredFieldValidator RequiredFieldValidator2 = (RequiredFieldValidator)edititem .FindControl("RequiredFieldValidator2"); RequiredFieldValidator2.Enabled = true; } else { RadComboBox trolleytype = (RadComboBox)edititem .FindControl("trolleytype_RadComboBox"); trolleytype.Visible = false; } }
protected void rcbCriteriaType_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { RadComboBox combobox = (RadComboBox)sender; GridEditFormItem edititem = (GridEditFormItem)combobox.NamingContainer; RadListBox rlbFrom = (RadListBox)edititem.FindControl("RadListBoxFrom"); RadListBox rlbTo = (RadListBox)edititem.FindControl("RadListBoxTo"); Label lblStoreDeliveryGroup = (Label)edititem.FindControl("lblStoreDeliveryGroup"); rlbFrom.Items.Clear(); rlbTo.Items.Clear(); StoreDelivCriteriaDAO storeDelivCriteria = new StoreDelivCriteriaDAO(); DataTable dtAvailableCriteria = storeDelivCriteria.GetAvailableStoreDelivCriteriaByType(lblStoreDeliveryGroup.Text, combobox.Text).Tables[0]; DataTable dtCriteria = storeDelivCriteria.GetStoreDelivCriteriaByType(lblStoreDeliveryGroup.Text, combobox.Text).Tables[0]; foreach (DataRow dr in dtAvailableCriteria.Rows) { rlbFrom.Items.Add(new RadListBoxItem(dr["crit_value"] as string, dr["crit_code"] as string)); } foreach (DataRow dr in dtCriteria.Rows) { rlbTo.Items.Add(new RadListBoxItem(dr["crit_value"] as string, dr["crit_code"] as string)); } }
protected void gvAdviserAlert_OnItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridEditFormInsertItem && e.Item.OwnerTableView.IsItemInserted) { GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item; GridEditFormItem gefi = (GridEditFormItem)e.Item; DropDownList ddlSIPDiscription = (DropDownList)gefi.FindControl("ddlSIPDiscription"); DropDownList ddlAlert = (DropDownList)gefi.FindControl("ddlAlert"); BindSIP(ddlSIPDiscription); BindAlert(ddlAlert); } if (e.Item is GridEditFormItem && e.Item.IsInEditMode && e.Item.ItemIndex != -1) { int ruleId = Convert.ToInt32(gvAdviserAlert.MasterTableView.DataKeyValues[e.Item.ItemIndex]["AAECR_RuleId"].ToString()); GridEditFormItem gefi = (GridEditFormItem)e.Item; DropDownList ddlSIPDiscription = (DropDownList)gefi.FindControl("ddlSIPDiscription"); DropDownList ddlAlert = (DropDownList)gefi.FindControl("ddlAlert"); TextBox txtRuleType = (TextBox)e.Item.FindControl("txtRuleType"); CheckBox chkActive = (CheckBox)e.Item.FindControl("chkActive"); CheckBox chkOverrite = (CheckBox)e.Item.FindControl("chkOverrite"); FillAdviserrole(ruleId, ddlSIPDiscription, ddlAlert, txtRuleType, chkActive, chkOverrite); } //if (e.Item is GridDataItem) //{ // GridDataItem gridItem = e.Item as GridDataItem; // gridItem.ToolTip = "Right click to Add/Edit"; //} }
private void SetEditForm(object sender, GridItemEventArgs e) { GridItem griditem = e.Item as GridItem; if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode)) { GridEditFormItem editform = (GridEditFormItem)e.Item; RadEditor _radEditorQualDescription = editform.FindControl(RADEDITQUALDESCR) as RadEditor; RadComboBox _radComboQualID = (RadComboBox)editform.FindControl(RADCOMBOQUALID); Button _btnUpdate = (Button)editform.FindControl("btnUpdate"); if (griditem.DataItem is PositionCompetencyKSA) { PositionCompetencyKSA PDCompetencyKSA = griditem.DataItem as PositionCompetencyKSA; _radEditorQualDescription.Content = PDCompetencyKSA.CompetencyKSA; _radComboQualID.SelectedValue = PDCompetencyKSA.QualificationID.ToString(); } if (e.Item is GridEditFormInsertItem) { //if (_tdsearch != null) _tdsearch.Visible = true; ////BindKSACombo(_radComboKSA); if (_btnUpdate != null) { _btnUpdate.CommandName = RadGrid.PerformInsertCommandName; _btnUpdate.Text = "Add KSA"; } rgJADuty.ShowFooter = false; if (rgQual.Items.Count <= 0) { this.rgQual.MasterTableView.NoMasterRecordsText = ""; this.rgQual.MasterTableView.EnableNoRecordsTemplate = false; } } else { ////if (_tdsearch != null) _tdsearch.Visible = false; //if (_trksadd != null) _trksadd.Visible = false; if (_btnUpdate != null) { _btnUpdate.CommandName = RadGrid.UpdateCommandName; _btnUpdate.Text = "Save KSA"; } if (IsInView) { _radComboQualID.Enabled = false; _radcomboQualificationTypeID.Enabled = false; if (_btnUpdate != null) { _btnUpdate.Enabled = false; } } rgJADuty.ShowFooter = true; } } }
protected void gvSchemeDetails_ItemDataBound(object sender, GridItemEventArgs e) { customerBo = new CustomerBo(); if (e.Item is GridEditFormInsertItem && e.Item.OwnerTableView.IsItemInserted) { GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item; TextBox txtBox = (TextBox)item.FindControl("txtSchemePlanCodeForEditForm"); TextBox txtBoxScName = (TextBox)item.FindControl("txtSchemePlanNameForEditForm"); //txtBox.Text = txtSchemePlanCode.Value; //txtBoxScName.Text = txtSchemeName.Text; txtBox.Enabled = false; txtBoxScName.Enabled = false; Button btn = (Button)item.FindControl("btnUpdate"); btn.Text = "add"; } if (e.Item is GridDataItem) { GridDataItem dataItem = e.Item as GridDataItem; string schemeName = dataItem["PASC_AMC_ExternalType"].Text; LinkButton buttonEdit = dataItem["editColumn"].Controls[0] as LinkButton; LinkButton buttonDelete = dataItem["deleteColumn"].Controls[0] as LinkButton; Label lbl = new Label(); lbl = (Label)e.Item.FindControl("lblFiletypeId"); if (schemeName == "AMFI" || schemeName == "ValueResearch" || schemeName == "AF") { buttonEdit.Enabled = false; buttonDelete.Enabled = false; buttonDelete.Attributes["onclick"] = "return alert('You cannot delete this scheme')"; buttonEdit.Attributes["onclick"] = "return alert('You cannot Edit this scheme')"; } } if (e.Item is GridEditFormItem && e.Item.IsInEditMode && e.Item.ItemIndex != -1) { string strExtType = gvSchemeDetails.MasterTableView.DataKeyValues[e.Item.ItemIndex]["PASC_AMC_ExternalType"].ToString(); strExternalCodeToBeEdited = gvSchemeDetails.MasterTableView.DataKeyValues[e.Item.ItemIndex]["PASC_AMC_ExternalCode"].ToString(); string IsOnline = gvSchemeDetails.MasterTableView.DataKeyValues[e.Item.ItemIndex]["PASC_IsOnline"].ToString(); if (Session["extCodeTobeEdited"] != null) { Session["extCodeTobeEdited"] = null; } Session["extCodeTobeEdited"] = strExternalCodeToBeEdited; GridEditFormItem editedItem = (GridEditFormItem)e.Item; DropDownList dropDownList = (DropDownList)editedItem.FindControl("ddlExternalType"); dropDownList.SelectedValue = strExtType; DropDownList ddlONline = (DropDownList)editedItem.FindControl("ddlONline"); if (IsOnline == "NO") { ddlONline.SelectedValue = 0.ToString(); } else { ddlONline.SelectedValue = 1.ToString(); } } }
protected void rcbstate_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) { RadComboBox rdState = (RadComboBox)o; GridEditFormItem editItem = (GridEditFormItem)rdState.NamingContainer; RadComboBox rdCity = (RadComboBox)editItem.FindControl("rcbCity"); RadComboBox rcbCountry = (RadComboBox)editItem.FindControl("rcbCountry"); if (rcbCountry.SelectedValue == "--Select--") { ShowPopUpMsg("Please Select Country"); } else if (rdState.SelectedValue == "--Select--") { ShowPopUpMsg("Please Select State"); } else { if (Request.QueryString["cid"] != null) { if (Request.QueryString["cid"].ToString() != string.Empty) { _clientid = Convert.ToInt32(Request.QueryString["cid"].ToString()); } } _countryid = Convert.ToInt32(rcbCountry.SelectedValue); if (rdState.SelectedValue.ToString().Contains("-")) { _stateid = Convert.ToInt32(rdState.SelectedValue.ToString().Substring(0, rdState.SelectedValue.ToString().IndexOf("-"))); } else { _stateid = Convert.ToInt32(rdState.SelectedValue); } //_stateid = Convert.ToInt32(rdState.SelectedValue.ToString().Substring(0, rdState.SelectedValue.ToString().IndexOf("-"))); //_stateid = Convert.ToInt32(rdState.SelectedValue); rdCity.Items.Clear(); DataSet dscity = objJobsBAL.CitySelectByClientIDCountryStateIDVisibleByAdmin(_clientid, _countryid, _stateid); if (dscity.Tables.Count > 0 && dscity.Tables[0].Rows.Count > 0) { rdCity.DataSource = dscity; rdCity.DataTextField = "CityName"; rdCity.DataValueField = "Lid"; rdCity.DataBind(); RadComboBoxItem ascityListItem = new RadComboBoxItem("--Select--", "--Select--"); rdCity.Items.Insert(0, ascityListItem); } else { rdCity.DataSource = null; rdCity.DataBind(); RadComboBoxItem ascityListItem = new RadComboBoxItem("--Select--", "--Select--"); rdCity.Items.Insert(0, ascityListItem); editItem["city"].Parent.Visible = false; } } }
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { DataSet dsRiskClass = new DataSet(); if (e.Item is GridCommandItem) { GridCommandItem cmditm = (GridCommandItem)e.Item; //to hide AddNewRecord button //cmditm.FindControl("InitInsertButton").Visible = false;//hide the text //cmditm.FindControl("AddNewRecordButton").Visible = false;//hide the image //to hide Refresh button cmditm.FindControl("RefreshButton").Visible = false; //hide the text cmditm.FindControl("RebindGridButton").Visible = false; //hide the image } if (e.Item is GridDataItem) { GridDataItem dataItem = e.Item as GridDataItem; string riskClassName = dataItem["XRC_RiskClass"].Text; LinkButton button = dataItem["DeleteColumn"].Controls[0] as LinkButton; button.Attributes["onclick"] = "return confirm('Are you sure you want to delete " + riskClassName + "?')"; } if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode)) { GridEditFormItem editform = (GridEditFormItem)e.Item; DropDownList ddl = (DropDownList)editform.FindControl("ddlPickRiskClass"); int adviserId = advisorVo.advisorId; HtmlTableRow trRiskCodeddl = (HtmlTableRow)editform.FindControl("trRiskCodeddl"); HtmlTableRow trRiskGoaltextBox = (HtmlTableRow)editform.FindControl("trRiskGoaltextBox"); if (e.Item.RowIndex == -1) { trRiskCodeddl.Visible = true; trRiskGoaltextBox.Visible = false; //dsRiskClass = modelPortfolioBo.bindDdlPickRiskClass(adviserId, Convert.ToInt16(ddlClassType.SelectedValue)); dsRiskClass = modelPortfolioBo.bindDdlPickRiskClass(adviserId, 1); if (dsRiskClass.Tables[0].Rows.Count > 0) { ddl.DataSource = dsRiskClass.Tables[0]; ddl.DataValueField = dsRiskClass.Tables[0].Columns["XRC_RiskClassCode"].ToString(); ddl.DataTextField = dsRiskClass.Tables[0].Columns["XRC_RiskClass"].ToString(); ddl.DataBind(); ddl.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select Risk Class", "Select Risk Class")); } } else { trRiskCodeddl.Visible = false; trRiskGoaltextBox.Visible = true; } } }
private void searchKSA_KSASearchCompleted(object sender, EventArgs e) { GridEditFormItem editform = rgDutyKSA.MasterTableView.GetItems(GridItemType.EditFormItem)[0] as GridEditFormItem; ctrlSearchKSA searchKSA = editform.FindControl("SearchKSA") as ctrlSearchKSA; RadComboBox radcomboKSA = editform.FindControl("radcomboKSA") as RadComboBox; Literal literalsearchmsg = editform.FindControl("literalSearchmsg") as Literal; searchKSA.SetSearchResultMessage(ref literalsearchmsg); radcomboKSA.Items.Clear(); setDefaultKSAOptionSelectedAndBindToControl(radcomboKSA, searchKSA.KSAList); }
protected void gvCustomerAlertSetup_OnItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridEditFormInsertItem && e.Item.OwnerTableView.IsItemInserted) { GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item; GridEditFormItem gefi = (GridEditFormItem)e.Item; DropDownList ddlSIPDiscription = (DropDownList)gefi.FindControl("ddlSIPDiscription"); DropDownList ddlAlert = (DropDownList)gefi.FindControl("ddlAlert"); BindCustomerSIP(ddlSIPDiscription); BindCustomerSIPRule(ddlAlert); } }
protected void rgDutyKSA_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridEditFormItem && e.Item.IsInEditMode) { GridEditFormItem editform = (GridEditFormItem)e.Item; ctrlSearchKSA searchKSA = editform.FindControl("SearchKSA") as ctrlSearchKSA; RadComboBox radcomboKSA = (RadComboBox)editform.FindControl("radcomboKSA"); searchKSA.KSASearchCompleted += new ctrlSearchKSA.KSASearchCompletedHandler(searchKSA_KSASearchCompleted); searchKSA.KSASearchCancelCompleted += new ctrlSearchKSA.KSASearchCancelCompleteHandler(searchKSA_KSASearchCancelCompleted); searchKSA.KSASearchClearCompleted += new ctrlSearchKSA.KSASearchClearCompleteHandler(searchKSA_KSASearchClearCompleted); radcomboKSA.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(radcomboKSA_SelectedIndexChanged); } }
private void searchKSA_KSASearchCancelCompleted(object sender, EventArgs e) { GridEditFormItem editform = rgDutyKSA.MasterTableView.GetItems(GridItemType.EditFormItem)[0] as GridEditFormItem; RadComboBox radcomboKSA = editform.FindControl("radcomboKSA") as RadComboBox; BindKSACombo(radcomboKSA); Literal literalsearchmsg = editform.FindControl("literalSearchmsg") as Literal; if (literalsearchmsg != null) { literalsearchmsg.Text = string.Empty; } }
protected void rcbState_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) { RadComboBox rdState = (RadComboBox)o; GridEditFormItem editItem = (GridEditFormItem)rdState.NamingContainer; RadComboBox rdCity = (RadComboBox)editItem.FindControl("rcbCity"); RadComboBox rcbCountry = (RadComboBox)editItem.FindControl("rcbCountry"); //Label lblCity = (Label)editItem.FindControl("lblCity"); if (rcbCountry.SelectedValue == "--Select--") { ShowPopUpMsg("Please Select Country"); } else if (rdState.SelectedValue == "--Select--") { ShowPopUpMsg("Please Select State"); } else { if (Session["SignInOrganizationId"] != null) { _clientid = Convert.ToInt32(Session["SignInOrganizationId"].ToString()); } _countryid = Convert.ToInt32(rcbCountry.SelectedValue); _stateid = Convert.ToInt32(rdState.SelectedValue); rdCity.Items.Clear(); DataSet dscity = populatecity(_countryid, _stateid); if (dscity.Tables.Count > 0 && dscity.Tables[0].Rows.Count > 0) { rdCity.DataSource = dscity; rdCity.DataTextField = "CityName"; rdCity.DataValueField = "CityId"; rdCity.DataBind(); RadComboBoxItem ascityListItem = new RadComboBoxItem("--Select--", "--Select--"); rdCity.Items.Insert(0, ascityListItem); rdCity.Focus(); } else { rdCity.DataSource = null; rdCity.DataBind(); RadComboBoxItem ascityListItem = new RadComboBoxItem("--Select--", "--Select--"); editItem["CityName"].Parent.Visible = false; //rdCity.Visible = false; //lblCity.Visible = false; rdCity.Items.Insert(0, ascityListItem); } } }
protected void ddlDepartMent_OnSelectedIndexChanged(object sender, EventArgs e) { int cnt = 0; DropDownList ddlDepartMent = (DropDownList)sender; GridEditFormItem gdi = (GridEditFormItem)(ddlDepartMent).NamingContainer; RadGrid rgRoles = (RadGrid)gdi.FindControl("rgRoles"); CheckBoxList rlbUserlist = (CheckBoxList)gdi.FindControl("rlbUserlist"); GetDepartmentWiseUserRole(Convert.ToInt32(ddlDepartMent.SelectedValue)); DataTable dtUserList = (DataTable)Cache[userVo.UserId.ToString() + "DepartRoles"]; rgRoles.DataSource = dtUserList; rgRoles.Rebind(); }
void searchKSA_KSASearchClearCompleted(object sender, EventArgs e) { GridEditFormItem editform = rgDutyKSA.MasterTableView.GetItems(GridItemType.EditFormItem)[0] as GridEditFormItem; Literal literalsearchmsg = editform.FindControl("literalSearchmsg") as Literal; if (literalsearchmsg != null) { literalsearchmsg.Text = string.Empty; } ctrlSearchKSA searchKSA = editform.FindControl("SearchKSA") as ctrlSearchKSA; RadComboBox radcomboKSA = (RadComboBox)editform.FindControl("radcomboKSA"); radcomboKSA.Items.Clear(); setDefaultKSAOptionSelectedAndBindToControl(radcomboKSA, searchKSA.KSAList); }
protected void rgMaping_ItemDataBound(object sender, GridItemEventArgs e) { try { if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode)) { GridEditFormItem editform = (GridEditFormItem)e.Item; DropDownList ddlWerp = (DropDownList)editform.FindControl("ddlWerp"); BindWerpValues(Convert.ToInt32(ddlCategory.SelectedValue), ddlWerp); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "ManageLookups.ascx.cs:rgMaping_ItemDataBound()"); object[] objects = new object[2]; objects[1] = sender; objects[2] = e; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
private void UpdatePDCompetencyKSAFactor(object source, GridCommandEventArgs e) { try { DateTime createDate = DateTime.Now; if (source is RadGrid) { GridEditFormItem gridItem = e.Item as GridEditFormItem; RadComboBox _radComboQualID = gridItem.FindControl(RADCOMBOQUALID) as RadComboBox; RadEditor _radEditorQualDescription = gridItem.FindControl(RADEDITQUALDESCR) as RadEditor; int competencyKSAID = int.Parse(gridItem.GetDataKeyValue("CompetencyKSAID").ToString()); if (competencyKSAID > -1) { PositionCompetencyKSA positionCompetency = new PositionCompetencyKSA(competencyKSAID); positionCompetency.KSAID = 0; //Other KSA positionCompetency.PositionDescriptionID = CurrentJNP.FullPDID; positionCompetency.CompetencyKSA = _radEditorQualDescription.Content; positionCompetency.Certification = String.Empty; positionCompetency.QualificationTypeID = (int)enumQualificationType.ConditionOfEmployment; positionCompetency.CreatedByID = CurrentUser.UserID; positionCompetency.CreateDate = createDate; positionCompetency.UpdatedByID = CurrentUser.UserID; positionCompetency.UpdateDate = createDate; positionCompetency.QualificationID = Convert.ToInt32(_radComboQualID.SelectedValue); //Don't want to overwrite the exsiting value with null //positionCompetency.AssociatedPDDutyID = null; JQFactor jqFactor = new JQFactor(Convert.ToInt32(CurrentJNP.JQID)); jqFactor.JQFactorTypeID = (int)enumJQFactorType.ConditionOfEmployment; jqFactor.KSAID = 0; //Other KSA jqFactor.IsSF = false; jqFactor.JQID = CurrentJNP.JQID; positionCompetency.UpdatePDCompetencyKSAFactor(positionCompetency, jqFactor); } } } catch (Exception ex) { base.HandleException(ex); } }
protected void gvCashSavingTransaction_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridEditFormInsertItem && e.Item.OwnerTableView.IsItemInserted) { GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item; DataTable dtCFCCategory = new DataTable(); GridEditFormItem gefi = (GridEditFormItem)e.Item; DropDownList ddlCFCCategory = (DropDownList)gefi.FindControl("ddlCFCCategory"); dtCFCCategory = customerAccountBo.GetCashFlowCategory(); ddlCFCCategory.DataSource = dtCFCCategory; ddlCFCCategory.DataValueField = dtCFCCategory.Columns["WERP_CFCCode"].ToString(); ddlCFCCategory.DataTextField = dtCFCCategory.Columns["WERP_CFCName"].ToString(); ddlCFCCategory.DataBind(); ddlCFCCategory.Items.Insert(0, new ListItem("Select", "Select")); } string strCasflowcategory; if (e.Item is GridEditFormItem && e.Item.IsInEditMode && e.Item.ItemIndex != -1) { int accountId = int.Parse(gvCashSavingTransaction.MasterTableView.DataKeyValues[e.Item.ItemIndex]["CCST_TransactionId"].ToString()); strCasflowcategory = gvCashSavingTransaction.MasterTableView.DataKeyValues[e.Item.ItemIndex]["WERP_CFCCode"].ToString(); string rdbType = gvCashSavingTransaction.MasterTableView.DataKeyValues[e.Item.ItemIndex]["CCST_IsWithdrwal"].ToString(); GridEditFormItem editedItem = (GridEditFormItem)e.Item; DataTable dtCFCCategory = new DataTable(); DropDownList ddlCFCCategory = (DropDownList)editedItem.FindControl("ddlCFCCategory"); RadioButton rbtnY = (RadioButton)e.Item.FindControl("rbtnYes"); RadioButton rbtnN = (RadioButton)e.Item.FindControl("rbtnNo"); dtCFCCategory = customerAccountBo.GetCashFlowCategory(); ddlCFCCategory.DataSource = dtCFCCategory; ddlCFCCategory.DataValueField = dtCFCCategory.Columns["WERP_CFCCode"].ToString(); ddlCFCCategory.DataTextField = dtCFCCategory.Columns["WERP_CFCName"].ToString(); ddlCFCCategory.DataBind(); ddlCFCCategory.SelectedValue = strCasflowcategory; if (rdbType == "CR") { rbtnY.Checked = false; rbtnN.Checked = true; } else { rbtnY.Checked = true; rbtnN.Checked = false; } rbtnN.Enabled = false; rbtnY.Enabled = false; RadDatePicker dpTransactionDate = (RadDatePicker)e.Item.FindControl("dpTransactionDate"); dpTransactionDate.SelectedDate = customeraccountVo.Transactiondate; } else { rbtnN.Enabled = true; rbtnY.Enabled = true; } }
protected void GridRole_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridEditFormItem && e.Item.IsInEditMode) { //编辑状态 if (!e.Item.OwnerTableView.IsItemInserted) { //获取Grid的主键值 this.strKeyID = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["RoleID"].ToString(); //判断主键是否为空 if (this.strKeyID != string.Empty) { //装换Guid类型 System.Guid Guid = new Guid(this.strKeyID); //实例化Entity实体 using (MWDatabaseEntities MWDB = new MWDatabaseEntities()) { //通过主键查询数据表获取外键字段 tblRole tblRoles = MWDB.tblRole.FirstOrDefault(d => d.RoleID == Guid); if (tblRoles != null) { //加载d_DicType //tbldicinfo.d_DicTypeReference.Load(); GridEditFormItem formItem = (GridEditFormItem)e.Item; //string StrDicTypeID = tblRoles.RoleName; //获取控件 RadTextBox textRoleName = formItem.FindControl("txtRoleName") as RadTextBox; RadTextBox textRoleCode = formItem.FindControl("textRoleCode") as RadTextBox; RadTextBox textDesc = formItem.FindControl("textDesc") as RadTextBox; RadComboBox ComBoxState = formItem.FindControl("ComBoxState") as RadComboBox; //为控件赋值 textRoleName.Text = tblRoles.RoleName; textRoleCode.Text = tblRoles.RoleCode; textDesc.Text = tblRoles.Desc; //下拉列表编辑时选择 ComBoxState.SelectedIndex = ComBoxState.Items.IndexOf(ComBoxState.Items.FindItemByValue(tblRoles.State.ToString())); } } } } } }
protected void grdProductOptions_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridEditableItem && e.Item.IsInEditMode) { GridEditFormItem item = e.Item as GridEditFormItem; RadComboBox ddlOptionType = item.FindControl("txtOptionType") as RadComboBox; ddlOptionType.DataSource = (from t in entities.OptionTypes select t).ToList(); } }
protected void rcbclient_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) { RadComboBox rdCountry = (RadComboBox)o; GridEditFormItem editItem = (GridEditFormItem)rdCountry.NamingContainer; RadComboBox rcbCountry = (RadComboBox)editItem.FindControl("rcbCountry"); rcbCountry.ClearSelection(); //rdCountry.SelectedValue = "--Select--"; }
protected void rGridTeam_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { try { if (e.Item is GridEditFormInsertItem) { GridEditFormInsertItem dataItem = e.Item as GridEditFormInsertItem; RadDropDownList rDDUserName = (RadDropDownList)dataItem.FindControl("rDDUserName"); rDDUserName.DataSource = aspUserBLL.ListAspUsers(); rDDUserName.DataValueField = "UserId"; rDDUserName.DataTextField = "UserName"; rDDUserName.DataBind(); } else if (e.Item is GridEditableItem && e.Item.IsInEditMode) { GridEditFormItem dataItem = e.Item as GridEditFormItem; RadDropDownList rDDUserName = (RadDropDownList)dataItem.FindControl("rDDUserName"); rDDUserName.DataSource = aspUserBLL.ListAspUsers(); rDDUserName.DataValueField = "UserId"; rDDUserName.DataTextField = "UserName"; rDDUserName.DataBind(); rDDUserName.SelectedValue = DataBinder.Eval(dataItem.DataItem, "OwnerUserID").ToString(); } else if (e.Item is GridDataItem) { GridDataItem dataItem = e.Item as GridDataItem; MembershipUser currentUser = Membership.GetUser(); if (!Roles.IsUserInRole(Page.User.Identity.Name, "CSBA_Admin")) { if (DataBinder.Eval(dataItem.DataItem, "OwnerUserID").ToString() != currentUser.ProviderUserKey.ToString()) { ImageButton EditButton = (ImageButton)dataItem["EditCommandColumn"].Controls[0]; EditButton.Visible = false; ImageButton deleteButton = (ImageButton)dataItem["Delete"].Controls[0]; deleteButton.Visible = false; } } } } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); string errMethod = sf.GetMethod().Name.ToString(); // Get the current method name string errMsg = "600"; // Gotta pass something, we're retro-fitting an existing method Session["LastException"] = ex; // Throw the exception in the session variable, will be used in error page string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL Response.Redirect(url); // Go to the error page. } }
protected void rgTipoCosto_DataBound(object source, GridItemEventArgs e) { if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode)) { GridEditFormItem editItem = (GridEditFormItem)e.Item; //Telerik.Web.UI.GridLinkButton Control insertbtn = (Control)editItem.FindControl("PerformInsertButton"); if (insertbtn != null) { (editItem.FindControl("RadNumericTextBox1") as RadNumericTextBox).Enabled = true; CapaEntidad.Region region = new Region(); Sesion session = new Sesion(); session = (Sesion)Session["Sesion" + Session.SessionID]; CapaNegocios.CN_CatRegion cn_region = new CapaNegocios.CN_CatRegion(); cn_region.ConsultaRegionConsecutivo(ref region, session); (editItem.FindControl("RadNumericTextBox1") as RadNumericTextBox).Text = region.Id_Reg.ToString(); } else { (editItem.FindControl("RadNumericTextBox1") as RadNumericTextBox).Enabled = false; } } if ((e.Item is GridDataItem) && (e.Item.IsDataBound)) { GridDataItem item = (GridDataItem)e.Item; switch (item["Estatus"].Text) { case "False": item["Estatus"].Text = "Inactivo"; break; case "True": item["Estatus"].Text = "Activo"; break; default: break; } } }
protected void cbSpecVal_CheckedChanged(object sender, EventArgs e) { CheckBox cbSpecVal = sender as CheckBox; GridEditFormItem editForm = cbSpecVal.NamingContainer as GridEditFormItem; Label lblfromval = (editForm.FindControl("lblfromval") as Label); Label lbltoval = (editForm.FindControl("lbltoval") as Label); RadNumericTextBox txtfromval = (editForm.FindControl("txtfromval") as RadNumericTextBox); RadNumericTextBox txttoval = (editForm.FindControl("txttoval") as RadNumericTextBox); RequiredFieldValidator RFVtxtfromval = (editForm.FindControl("RFVtxtfromval") as RequiredFieldValidator); RequiredFieldValidator RFVtxttoval = (editForm.FindControl("RFVtxttoval") as RequiredFieldValidator); if (cbSpecVal.Checked) { lblfromval.Visible = true; lbltoval.Visible = true; txtfromval.Visible = true; txttoval.Visible = true; RFVtxtfromval.Enabled = true; RFVtxttoval.Enabled = true; } else { lblfromval.Visible = false; lbltoval.Visible = false; txtfromval.Visible = false; txttoval.Visible = false; RFVtxtfromval.Enabled = false; RFVtxttoval.Enabled = false; } }
protected void grdProductAdon_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridEditableItem && e.Item.IsInEditMode) { GridEditFormItem item = e.Item as GridEditFormItem; RadComboBox ddlPAdOnType = item.FindControl("txtAdonType") as RadComboBox; ddlPAdOnType.DataSource = _adonTypeManager.GetAllAdonType(); } else if (e.Item is GridGroupHeaderItem) { GridGroupHeaderItem item = e.Item as GridGroupHeaderItem; } }
//protected void ddlPickScheme_OnSelectedIndexChanged(object sender, GridItemEventArgs e) //{ //} //protected void ddlPickScheme_OnSelectedIndexChanged(object sender, EventArgs e) //{ // //DropDownList dropdown = (DropDownList)sender; // //string a = dropdown.SelectedValue; //} protected void RadGrid1_ItemUpdated(object source, GridCommandEventArgs e) { if (e.CommandName == RadGrid.UpdateCommandName) { if (e.Item is GridEditFormItem) { GridEditFormItem item = (GridEditFormItem)e.Item; DropDownList ddl = (DropDownList)item.FindControl("ddlPickScheme"); BindDDLSchemeAllocated(ddl); RadGrid1.Rebind(); } } }
protected void gvAdviserList_OnItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridEditFormInsertItem && e.Item.OwnerTableView.IsItemInserted) { GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item; GridEditFormItem gefi = (GridEditFormItem)e.Item; DropDownList ddlDepartMent = (DropDownList)gefi.FindControl("ddlDepartMent"); BindDepartmentddl(ddlDepartMent); } if (e.Item is GridEditFormItem && e.Item.IsInEditMode && e.Item.ItemIndex != -1) { int roleId = Convert.ToInt32(gvAdviserList.MasterTableView.DataKeyValues[e.Item.ItemIndex]["AR_RoleId"].ToString()); GridEditFormItem editedItem = (GridEditFormItem)e.Item; DropDownList ddlDepartMent = (DropDownList)editedItem.FindControl("ddlDepartMent"); TextBox txtRoleName = (TextBox)editedItem.FindControl("txtRoleName"); TextBox txtNote = (TextBox)editedItem.FindControl("txtNote"); RadGrid rgRoles = (RadGrid)editedItem.FindControl("rgRoles"); //BindPopUpcontrols(roleId, ddlDepartMent, txtRoleName, txtNote, rgRoles); FillAdviserrole(roleId, ddlDepartMent, txtRoleName, txtNote, rgRoles); } }
protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e) { GridEditFormItem editForm = (GridEditFormItem)e.Item; RadAsyncUpload upload = (RadAsyncUpload)editForm.FindControl("RadAsyncUpload1"); if (upload != null) { foreach (UploadedFile file in upload.UploadedFiles) { string target = Server.MapPath("~/Uploads/"); file.SaveAs(target + file.FileName); } } }
private void AssignJADutyKSAFactorValues(JobAnalysisDutyKSAFactor jaDutyKSAFactor, GridCommandEventArgs e) { GridEditFormItem editform = (GridEditFormItem)e.Item; RadComboBox radcomboKSA = (RadComboBox)editform.FindControl("radcomboKSA"); RadEditor radEditorJAKSADescription = editform.FindControl("radEditorJAKSADescription") as RadEditor; RadComboBox radComboDutyQualID = (RadComboBox)editform.FindControl("radComboDutyQualID"); RadComboBox radcomboQualificationTypeID = (RadComboBox)editform.FindControl("radcomboQualificationTypeID"); var jqFactorTypeId = GetJQFactorTypeIdFromQualificationTypeId(int.Parse(radcomboQualificationTypeID.SelectedValue)); jaDutyKSAFactor.JADutyID = base.CurrentJADutyID; jaDutyKSAFactor.JQID = base.CurrentJQID; jaDutyKSAFactor.JQFactorTitle = radEditorJAKSADescription.Text; jaDutyKSAFactor.QualificationID = int.Parse(radComboDutyQualID.SelectedValue); jaDutyKSAFactor.QualificationTypeID = int.Parse(radcomboQualificationTypeID.SelectedValue); jaDutyKSAFactor.JQFactorTypeID = jqFactorTypeId; jaDutyKSAFactor.UpdatedByID = base.CurrentUserID; jaDutyKSAFactor.UpdateDate = DateTime.Now; if (e.CommandName == RadGrid.PerformInsertCommandName) { jaDutyKSAFactor.KSAID = long.Parse(radcomboKSA.SelectedValue); jaDutyKSAFactor.IsFinalKSA = (jqFactorTypeId == (int)enumJQFactorType.SelectiveFactor); jaDutyKSAFactor.ImportanceID = enumImportanceScale.None; jaDutyKSAFactor.NeedAtEntryID = enumNeedAtEntryScale.None; jaDutyKSAFactor.DistinguishingValueScaleID = enumDistinguishingValueScale.None; jaDutyKSAFactor.CreatedByID = base.CurrentUserID; jaDutyKSAFactor.CreateDate = DateTime.Now; } if (e.CommandName == RadGrid.UpdateCommandName) { if (System.Configuration.ConfigurationManager.AppSettings["ShowQualFactorInstructionButton"].ToString().ToLower() == "false") { jaDutyKSAFactor.JQFactorInstruction = radEditorJAKSADescription.Text; } } }