protected void rdoIsMater_Init(object sender, EventArgs e) { ASPxRadioButton radioBtn = sender as ASPxRadioButton; DevExpress.Web.ASPxGridView.GridViewDataItemTemplateContainer container = radioBtn.NamingContainer as DevExpress.Web.ASPxGridView.GridViewDataItemTemplateContainer; Guid key = Guid.Parse((container).KeyValue.ToString()); NAS.DAL.Nomenclature.Item.ItemUnitTypeConfig config = session.GetObjectByKey <NAS.DAL.Nomenclature.Item.ItemUnitTypeConfig>(key); string para = "master," + config.UnitTypeId.UnitTypeId.ToString(); radioBtn.ClientInstanceName = String.Format("rdoIsMater_{0}", container.VisibleIndex); string code = "function(s, e){ "; for (int i = 0; i < grdUnitType.VisibleRowCount; i++) { if (container.VisibleIndex != i) { code += String.Format("rdoIsMater_{0}.SetChecked(false); ", i); } } code += "if (s.GetChecked())" + string.Format("grdUnitType.PerformCallback('{0}');", para + ",1") + " else " + string.Format("grdUnitType.PerformCallback('{0}');", para + ",0") + "}"; radioBtn.ClientSideEvents.CheckedChanged = code; }
protected void rdoIsDefault_Init(object sender, EventArgs e) { ASPxRadioButton radioBtn = sender as ASPxRadioButton; DevExpress.Web.ASPxTreeList.TreeListDataCellTemplateContainer container = radioBtn.NamingContainer as DevExpress.Web.ASPxTreeList.TreeListDataCellTemplateContainer; Guid key = Guid.Parse((container).NodeKey.ToString()); radioBtn.Checked = false; string para = "default," + key.ToString(); radioBtn.ClientInstanceName = String.Format("rdoIsDefault_{0}", container.NodeKey.ToString()); string code = "function(s, e){ "; foreach (TreeListNode node in treelstProductUnits.Nodes) { TreeListNodeIterator iterator = new TreeListNodeIterator(node); while (iterator.Current != null) { if (!container.NodeKey.Equals(iterator.Current.Key)) { code += String.Format("rdoIsDefault_{0}.SetChecked(false); ", iterator.Current.Key); } iterator.GetNext(); } } code += "if (s.GetChecked())" + string.Format("treelstProductUnits.PerformCallback('{0}');", para + ",1") + " else " + string.Format("treelstProductUnits.PerformCallback('{0}');", para + ",0") + "}"; radioBtn.ClientSideEvents.CheckedChanged = code; }
protected void ASPxGridView1_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType == GridViewRowType.Data) { ASPxGridView grid = sender as ASPxGridView; ASPxRadioButton discontinued = grid.FindRowCellTemplateControl(e.VisibleIndex, grid.Columns["Discontinued"] as GridViewDataColumn, "btnDiscontinued") as ASPxRadioButton; ASPxRadioButton inproduction = grid.FindRowCellTemplateControl(e.VisibleIndex, grid.Columns["InProduction"] as GridViewDataColumn, "btnInProduction") as ASPxRadioButton; discontinued.ClientInstanceName = "btnDiscontinued" + e.VisibleIndex; inproduction.ClientInstanceName = "btnInProduction" + e.VisibleIndex; inproduction.ClientSideEvents.CheckedChanged = String.Format("function (s,e) {{if(btnInProduction{0}.GetChecked()) {{btnDiscontinued{0}.SetChecked(false);}}}}", e.VisibleIndex); discontinued.ClientSideEvents.CheckedChanged = String.Format("function (s,e) {{if(btnDiscontinued{0}.GetChecked()) {{btnInProduction{0}.SetChecked(false);}}}}", e.VisibleIndex); } }
// 新增 protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { ASPxTextBox uCode = ASPxGridView1.FindEditFormTemplateControl("txtUCode") as ASPxTextBox; ASPxTextBox uName = ASPxGridView1.FindEditFormTemplateControl("txtUName") as ASPxTextBox; ASPxRadioButton radM = ASPxGridView1.FindEditFormTemplateControl("RadMan") as ASPxRadioButton; ASPxRadioButton radW = ASPxGridView1.FindEditFormTemplateControl("RadWoman") as ASPxRadioButton; ASPxTextBox authIp = ASPxGridView1.FindEditFormTemplateControl("txtIp") as ASPxTextBox; ASPxTextBox uMax = ASPxGridView1.FindEditFormTemplateControl("TextBoxMax") as ASPxTextBox; ASPxTextBox uTel = ASPxGridView1.FindEditFormTemplateControl("txtTel") as ASPxTextBox; ASPxTextBox uEmail = ASPxGridView1.FindEditFormTemplateControl("txtEmail") as ASPxTextBox; ASPxTextBox uQQ = ASPxGridView1.FindEditFormTemplateControl("TextQQ") as ASPxTextBox; ASPxTextBox uWeChat = ASPxGridView1.FindEditFormTemplateControl("txtWeChat") as ASPxTextBox; ASPxCheckBox chVFlag = ASPxGridView1.FindEditFormTemplateControl("chValidFlag") as ASPxCheckBox; ASPxCheckBox chLFlag = ASPxGridView1.FindEditFormTemplateControl("chLockFlag") as ASPxCheckBox; ASPxComboBox uDept = ASPxGridView1.FindEditFormTemplateControl("txtDept") as ASPxComboBox; string vFlag = ""; if (chVFlag.Checked == true) { vFlag = "Y"; } else { vFlag = "N"; } string uSex = ""; if (radM.Checked == true) { uSex = "M"; } if (radW.Checked == true) { uSex = "F"; } string email = uEmail.Text.Trim(); email = email.Replace("@", "@@"); string inSql = "INSERT INTO CODE_USER (COMPANY_CODE, USER_ID, USER_CODE, USER_NAME, USER_SEX, USER_PASSWORD,USER_AUTHORIZED_IP,USER_MAXNUM,VALID_FLAG,LOCK_FLAG,USER_EMAIL,USER_TEL,USER_QQ,USER_WECHAT,USER_DEPT_CODE,user_type) " + "VALUES('" + theCompanyCode + "',TRIM(TO_CHAR(SEQ_USER_ID.NEXTVAL,'000000')),'" + uCode.Text.Trim().ToUpper() + "','" + uName.Text.Trim() + "','" + uSex + "','" + thePubPc.AESEncrypt(uCode.Text.Trim().ToUpper()) + "'," + "'" + authIp.Text.Trim() + "','" + uMax.Text.Trim() + "','" + vFlag + "','0','" + email + "','" + uTel.Text.Trim() + "','" + uQQ.Text.Trim() + "','" + uWeChat.Text.Trim() + "','" + uDept.Value.ToString() + "','A')"; dataConn inDc = new dataConn(); inDc.ExeSql(inSql); inDc.CloseConn(); e.Cancel = true; ASPxGridView1.CancelEdit(); queryFunction(); }
protected void ASPxButton1_Click(object sender, EventArgs e) { for (int i = ASPxGridView1.VisibleStartIndex; i < ASPxGridView1.VisibleStartIndex + ASPxGridView1.VisibleRowCount; i++) { ASPxRadioButton discontinued = ASPxGridView1.FindRowCellTemplateControl(i, ASPxGridView1.Columns["Discontinued"] as GridViewDataColumn, "btnDiscontinued") as ASPxRadioButton; object[] vals = (object[])ASPxGridView1.GetRowValues(i, new string[] { "ProductName", "UnitPrice", "ProductID" }); SqlDataSource1.UpdateParameters["ProductName"].DefaultValue = vals[0].ToString(); SqlDataSource1.UpdateParameters["UnitPrice"].DefaultValue = vals[1].ToString(); SqlDataSource1.UpdateParameters["ProductID"].DefaultValue = vals[2].ToString(); SqlDataSource1.UpdateParameters["Discontinued"].DefaultValue = discontinued.Checked.ToString(); //SqlDataSource1.Update(); //uncomment this line to submit changes to the database } }
public List<WebControl> RenderControl(XmlNode xmlControl) { base.Initialize(xmlControl); XmlNode valuesNode = _PropertyMapper.GetValuesNode(); var firstPass = true; var groupName = string.Empty; var name = string.Empty; foreach (XmlNode xmlValueNode in valuesNode.ChildNodes) { if (firstPass) { firstPass = false; groupName = "Group" + _PropertyMapper.GetName(); name = _PropertyMapper.GetID(); } ASPxRadioButton aspxRadioButton = new ASPxRadioButton { ID = "rad" + xmlValueNode.GetAttribute("CCLAVE"), Text = xmlValueNode.GetAttribute("CTEXTO"), Value = xmlValueNode.GetAttribute("CCLAVE"), ClientInstanceName = name, Checked = (_PropertyMapper.GetDefault() == xmlValueNode.GetAttribute("CCLAVE")) ? true : false, GroupName = groupName }; try { if (xmlControl.GetAttribute("CCONTROLASOC") != null) { aspxRadioButton.ClientSideEvents.CheckedChanged = "function(s, e) { if(s.GetChecked()) {" + xmlControl.GetAttribute("CCONTROLASOC") + ".PerformCallback('" + xmlValueNode.GetAttribute("CCLAVE") + "');} }"; aspxRadioButton.ClientSideEvents.Init = "function(s, e) { if(s.GetChecked()) {" + xmlControl.GetAttribute("CCONTROLASOC") + ".PerformCallback('" + xmlValueNode.GetAttribute("CCLAVE") + "');} }"; } } catch (Exception) { } _Controls.Add(aspxRadioButton); } return _Controls; }
protected override WebControl CreateEditModeControlCore() { Panel placeHolder = new Panel(); controlsHash.Clear(); foreach (object enumValue in enumDescriptor.Values) { ASPxRadioButton radioButton = new ASPxRadioButton(); radioButton.ID = "radioButton_" + enumValue.ToString(); controlsHash.Add(radioButton, enumValue); radioButton.Text = enumDescriptor.GetCaption(enumValue); radioButton.CheckedChanged += new EventHandler(radioButton_CheckedChanged); radioButton.GroupName = propertyName; placeHolder.Controls.Add(radioButton); } return(placeHolder); }
protected void gridInterviewDet_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { ASPxGridView grd = sender as ASPxGridView; ASPxTextBox name = grd.FindEditFormTemplateControl("txt_Name") as ASPxTextBox; if (SafeValue.SafeString(name.Text).Length < 1) { throw new Exception("Name not be null !!!"); return; } ASPxRadioButton married = grd.FindEditFormTemplateControl("rbt_Married") as ASPxRadioButton; if (married.Checked) { e.NewValues["Married"] = "Y"; } else { e.NewValues["Married"] = "N"; } e.NewValues["InterviewId"] = SafeValue.SafeString(e.NewValues["InterviewId"], ""); e.NewValues["RecruitId"] = SafeValue.SafeString(e.NewValues["RecruitId"], ""); e.NewValues["Gender"] = SafeValue.SafeString(e.NewValues["Gender"]); e.NewValues["IcNo"] = SafeValue.SafeString(e.NewValues["IcNo"]); e.NewValues["BirthDay"] = SafeValue.SafeDate(e.NewValues["BirthDay"], new DateTime(1753, 1, 1)); e.NewValues["Country"] = SafeValue.SafeString(e.NewValues["Country"]); e.NewValues["Race"] = SafeValue.SafeString(e.NewValues["Race"]); e.NewValues["Religion"] = SafeValue.SafeString(e.NewValues["Religion"]); e.NewValues["Telephone"] = SafeValue.SafeString(e.NewValues["Telephone"]); e.NewValues["Email"] = SafeValue.SafeString(e.NewValues["Email"]); e.NewValues["Address"] = SafeValue.SafeString(e.NewValues["Address"]); e.NewValues["Remark"] = SafeValue.SafeString(e.NewValues["Remark"]); e.NewValues["Remark1"] = SafeValue.SafeString(e.NewValues["Remark1"]); e.NewValues["Remark2"] = SafeValue.SafeString(e.NewValues["Remark2"]); e.NewValues["Remark3"] = SafeValue.SafeString(e.NewValues["Remark3"]); e.NewValues["Remark4"] = SafeValue.SafeString(e.NewValues["Remark4"]); e.NewValues["UpdateBy"] = HttpContext.Current.User.Identity.Name; e.NewValues["UpdateDateTime"] = DateTime.Now; }
protected void BindExisting(ASPxSpinEdit txtSerialLevel, ASPxTextBox txtNameLevel, ASPxTextBox txtAbbrLevel, string ORG_SERIAL, ASPxRadioButton rdActive, ASPxRadioButton rdCancel) { string SQL = "select ORG_SERIAL,ORG_NAME,ORG_ABBR,ORG_TYPE,ORG_STATUS from CTLT_ORGANIZE where ORG_SERIAL='" + ORG_SERIAL + "'"; SqlDataAdapter DA = new SqlDataAdapter(SQL, OPM_BL.DefaultConnectionString); DataTable DT = new DataTable(); DA.Fill(DT); if (DT.Rows.Count > 0) { txtSerialLevel.Text = DT.Rows[0]["ORG_SERIAL"].ToString(); txtSerialLevel.ReadOnly = true; txtSerialLevel.BackColor = System.Drawing.Color.Gray; txtNameLevel.Text = DT.Rows[0]["ORG_NAME"].ToString(); txtAbbrLevel.Text = DT.Rows[0]["ORG_ABBR"].ToString(); if ( DT.Rows[0]["ORG_STATUS"].ToString() == "A"){ rdActive .Checked =true ; rdCancel.Checked =false ; }else{ rdActive .Checked =false ; rdCancel.Checked =true ; } } else { txtSerialLevel.Text = ""; txtSerialLevel.ReadOnly = false; txtSerialLevel.BackColor = System.Drawing.Color.White; txtNameLevel.Text = ""; txtAbbrLevel.Text = ""; rdActive.Checked = true; rdCancel.Checked = false; } }
// 直接在函数中将控件布局写好,而参数就是数据库中的code值 http://www.cnblogs.com/Clingingboy/archive/2006/09/04/494737.html public System.Web.UI.Control GetDisplayControl(List <DictionaryItem> detaillist) { // 单选框 true if (ModuleField.SingleOrMultiple) { ASPxPanel panel = new ASPxPanel(); panel.Controls.Add(new LiteralControl("<table align='center'>")); int i = 0; foreach (DictionaryItem codedetail in detaillist) { i++; ASPxRadioButton rb = new ASPxRadioButton(); rb.GroupName = "rbtn"; rb.AutoPostBack = false; rb.Text = codedetail.DictionaryItemName; rb.Value = codedetail.DictionaryItemValue; panel.Controls.Add(new LiteralControl("<tr><td>")); panel.Controls.Add(rb); panel.Controls.Add(new LiteralControl("</td></tr>")); } panel.Controls.Add(new LiteralControl("</table>")); return(panel); } // 复选框 if (!ModuleField.SingleOrMultiple) { ASPxPanel panel = new ASPxPanel(); panel.Controls.Add(new LiteralControl("<table align='center'>")); int i = 0; foreach (DictionaryItem codedetail in detaillist) { i++; ASPxCheckBox cb = new ASPxCheckBox(); if (IsTree) { //cb.ClientSideEvents.CheckedChanged = "checkchanged";//"function(e,args){checkchanged(e,args);}"; //首先判断该节点是否是父节点:如果是的话,就加载hyperlink超链接;反之就不做超链接 //if (cb.Checked) if (true) { cb.Text = ""; cb.Value = ""; string link = "<a onclick=\"navclicked(\'" + codedetail.DictionaryItemCode + "\',\'" + codedetail.DictionaryItemName + "\',2)\">" + codedetail.DictionaryItemName + "</a>"; panel.Controls.Add(new LiteralControl("<tr><td>")); panel.Controls.Add(cb); panel.Controls.Add(new LiteralControl(link)); } } else { cb.Text = codedetail.DictionaryItemName; cb.Value = codedetail.DictionaryItemValue; panel.Controls.Add(new LiteralControl("<tr><td>")); panel.Controls.Add(cb); } panel.Controls.Add(new LiteralControl("</td></tr>")); } panel.Controls.Add(new LiteralControl("</table>")); return(panel); } return(new LiteralControl("")); }
public static void AddChoiceQuestionAdvanced(BusinessLogicLayer.Entities.Conference.ConferenceRegistrationType Q, Panel QuestionPanel) { Table table = new Table(); table.Style.Add("width", "100%"); #region Date Row TableRow rowDate = new TableRow(); TableCell cellDate = new TableCell(); cellDate.ColumnSpan = 2; cellDate.Style.Add("font-weight", "bold"); //cellDate.Style.Add("text-align", "center"); //string hijriDate = ""; //string miladyDate = ""; //if (Q.CurrentSchedule != null) //{ // hijriDate = Code.RbmCommon.ConferenceBasePage.GregToHijri(Q.CurrentSchedule.StartTime); // miladyDate = Q.CurrentSchedule.StartTime.ToShortDateString(); //} //else //{ // hijriDate = Code.RbmCommon.ConferenceBasePage.GregToHijri(Q.StartDate); // miladyDate = Q.StartDate.ToShortDateString(); //} //cellDate.Text = String.Format("{0} - {1}", miladyDate, hijriDate); rowDate.Cells.Add(cellDate); table.Rows.Add(rowDate); #endregion #region Header Row TableRow rowHeader = new TableRow(); rowHeader.Style.Add("background-color", "#18335F"); rowHeader.Style.Add("color", "#FFFFFF"); TableCell cellTime = new TableCell(); cellTime.Style.Add("width", "185px"); //cellTime.Style.Add("text-align", "center"); cellTime.Text = CommonWeb.Resources.CommonResource.RegistrationForm_Time; TableCell cellTitle = new TableCell(); //cellTitle.Style.Add("text-align", "center"); cellTitle.Text = Q.DescriptionLanguage; rowHeader.Cells.Add(cellTime); rowHeader.Cells.Add(cellTitle); table.Rows.Add(rowHeader); #endregion #region Content Row TableRow rowContent = new TableRow(); TableCell cellTimeContent = new TableCell(); string hijriDate = ""; string miladyDate = ""; if (Q.CurrentSchedule != null) { hijriDate = BasePage.GregToHijri(Q.CurrentSchedule.StartTime); miladyDate = Q.CurrentSchedule.StartTime.ToShortDateString(); } else { hijriDate = BasePage.GregToHijri(Q.StartDate); miladyDate = Q.StartDate.ToShortDateString(); } cellTimeContent.Text = String.Format("{0} - {1}<br/>", miladyDate, hijriDate); if (Q.CurrentSchedule == null) cellTimeContent.Text += ""; else { if (Q.LanguageID == 2) cellTimeContent.Text += Q.CurrentSchedule.StartTime.ToShortTimeString().Replace("AM", "ص").Replace("PM", "م") + " - " + Q.CurrentSchedule.EndTime.ToShortTimeString().Replace("AM", "ص").Replace("PM", "م"); else cellTimeContent.Text += Q.CurrentSchedule.StartTime.ToShortTimeString() + " - " + Q.CurrentSchedule.EndTime.ToShortTimeString(); } TableCell cellTitleContent = new TableCell(); cellTitleContent.Style.Add("font-weight", "bold"); cellTitleContent.Style.Add("text-align",CommonWeb.Resources.CommonResource.Direction); ASPxRadioButton checkBox = new ASPxRadioButton(); checkBox.GroupName = Q.GroupName; checkBox.Text = Q.NameLanguage; checkBox.ID = "ChoiceList" + Q.ConferenceRegistrationTypeId; cellTitleContent.Controls.Add(checkBox); rowContent.Cells.Add(cellTimeContent); rowContent.Cells.Add(cellTitleContent); table.Rows.Add(rowContent); #endregion QuestionPanel.Controls.Add(table); }
// 修改 protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { string userId = (ASPxGridView1.FindEditFormTemplateControl("HidUserId") as HiddenField).Value; ASPxTextBox uCode = ASPxGridView1.FindEditFormTemplateControl("txtUCode") as ASPxTextBox; ASPxTextBox uName = ASPxGridView1.FindEditFormTemplateControl("txtUName") as ASPxTextBox; ASPxRadioButton radM = ASPxGridView1.FindEditFormTemplateControl("RadMan") as ASPxRadioButton; ASPxRadioButton radW = ASPxGridView1.FindEditFormTemplateControl("RadWoman") as ASPxRadioButton; ASPxTextBox authIp = ASPxGridView1.FindEditFormTemplateControl("txtIp") as ASPxTextBox; ASPxTextBox uMax = ASPxGridView1.FindEditFormTemplateControl("TextBoxMax") as ASPxTextBox; ASPxTextBox uTel = ASPxGridView1.FindEditFormTemplateControl("txtTel") as ASPxTextBox; ASPxTextBox uEmail = ASPxGridView1.FindEditFormTemplateControl("txtEmail") as ASPxTextBox; ASPxTextBox uQQ = ASPxGridView1.FindEditFormTemplateControl("TextQQ") as ASPxTextBox; ASPxTextBox uWeChat = ASPxGridView1.FindEditFormTemplateControl("txtWeChat") as ASPxTextBox; ASPxCheckBox chVFlag = ASPxGridView1.FindEditFormTemplateControl("chValidFlag") as ASPxCheckBox; ASPxCheckBox chLFlag = ASPxGridView1.FindEditFormTemplateControl("chLockFlag") as ASPxCheckBox; ASPxComboBox uDept = ASPxGridView1.FindEditFormTemplateControl("txtDept") as ASPxComboBox; string vFlag = ""; if (chVFlag.Checked == true) { vFlag = "Y"; } else { vFlag = "N"; } string uSex = ""; if (radM.Checked == true) { uSex = "M"; } if (radW.Checked == true) { uSex = "F"; } int lFlag; if (chLFlag.Checked == true) { lFlag = 3; } else { lFlag = 0; } string email = uEmail.Text.Trim(); email = email.Replace("@", "@@"); string upSql = "UPDATE CODE_USER SET USER_CODE='" + uCode.Text.Trim().ToUpper() + "',USER_NAME='" + uName.Text.Trim() + "',USER_SEX='" + uSex + "'," + "USER_AUTHORIZED_IP='" + authIp.Text.Trim() + "',USER_MAXNUM='" + uMax.Text.Trim() + "',VALID_FLAG='" + vFlag + "',LOCK_FLAG='" + lFlag + "'," + "USER_EMAIL='" + email + "',USER_TEL='" + uTel.Text.Trim() + "',USER_QQ='" + uQQ.Text.Trim() + "',USER_WECHAT='" + uWeChat.Text.Trim() + "',USER_DEPT_CODE='" + uDept.Value.ToString() + "' " + "WHERE COMPANY_CODE = '" + theCompanyCode + "' AND USER_ID='" + userId + "'"; theDc.ExeSql(upSql); e.Cancel = true; ASPxGridView1.CancelEdit(); queryFunction(); }