protected override void AttachChildControls() { PageTitle.AddSiteNameTitle("店铺消息"); this.imglogo = (System.Web.UI.HtmlControls.HtmlImage) this.FindControl("imglogo"); this.hdlogo = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hdlogo"); this.txtstorename = (System.Web.UI.HtmlControls.HtmlInputText) this.FindControl("txtstorename"); this.txtdescription = (System.Web.UI.HtmlControls.HtmlTextArea) this.FindControl("txtdescription"); this.txtacctount = (System.Web.UI.HtmlControls.HtmlInputText) this.FindControl("txtacctount"); this.txtStoreTel = (System.Web.UI.HtmlControls.HtmlInputText) this.FindControl("txtStoreTel"); DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(Globals.GetCurrentMemberUserId()); if (userIdDistributors.ReferralStatus != 0) { System.Web.HttpContext.Current.Response.Redirect("MemberCenter.aspx"); } else { MemberInfo currentMember = MemberProcessor.GetCurrentMember(); if (userIdDistributors != null) { if (!string.IsNullOrEmpty(userIdDistributors.Logo)) { this.imglogo.Src = userIdDistributors.Logo; } this.hdlogo.Value = userIdDistributors.Logo; this.txtstorename.Value = userIdDistributors.StoreName; this.txtdescription.Value = userIdDistributors.StoreDescription; this.txtacctount.Value = userIdDistributors.RequestAccount; this.txtStoreTel.Value = currentMember.CellPhone; } } }
private void CreateBottomForm(Control container) { using (HtmlGenericControl form = HtmlControlHelper.GetForm()) { form.Attributes.Add("style", "width:300px;"); using (HtmlGenericControl field = HtmlControlHelper.GetField()) { using (HtmlGenericControl label = HtmlControlHelper.GetLabel(Titles.StatementReference, "StatementReferenceTextArea")) { field.Controls.Add(label); } using (HtmlTextArea statementReferenceTextArea = new HtmlTextArea()) { statementReferenceTextArea.ID = "StatementReferenceTextArea"; statementReferenceTextArea.Rows = 4; field.Controls.Add(statementReferenceTextArea); } form.Controls.Add(field); } this.CreateSaveButton(form); container.Controls.Add(form); } }
protected void Button1_Click(object sender, EventArgs e) { System.Web.UI.HtmlControls.HtmlTextArea htaDemo = (System.Web.UI.HtmlControls.HtmlTextArea)(TextArea1.FindControl("TextArea1")); string msg = htaDemo.Value; Label1.Text = msg; }
private void AddContent(HtmlGenericControl container) { using (HtmlGenericControl content = new HtmlGenericControl("div")) { content.Attributes.Add("class", "ui inverted red content"); using (HtmlGenericControl form = HtmlControlHelper.GetForm()) { using (HtmlGenericControl header = new HtmlGenericControl("div")) { header.Attributes.Add("class", "ui blue large dividing header"); form.Controls.Add(header); } using (HtmlGenericControl field = HtmlControlHelper.GetField()) { using (HtmlGenericControl label = HtmlControlHelper.GetLabel(Titles.VerificationReason, "ReasonTextArea")) { field.Controls.Add(label); } using (HtmlTextArea textArea = new HtmlTextArea()) { textArea.ID = "ReasonTextArea"; field.Controls.Add(textArea); } form.Controls.Add(field); } content.Controls.Add(form); } container.Controls.Add(content); } }
protected override void AttachChildControls() { this.shipTo = (HtmlInputText) this.FindControl("shipTo"); this.address = (HtmlTextArea) this.FindControl("address"); this.cellphone = (HtmlInputText) this.FindControl("cellphone"); this.Hiddenshipid = (HtmlInputHidden) this.FindControl("shipId"); this.regionText = (HtmlInputHidden) this.FindControl("regionText"); this.region = (HtmlInputHidden) this.FindControl("region"); ShippingAddressInfo shippingAddress = MemberProcessor.GetShippingAddress(this.shippingid); string fullRegion = RegionHelper.GetFullRegion(shippingAddress.RegionId, " "); this.shipTo.Value = shippingAddress.ShipTo; this.address.Value = shippingAddress.Address; this.cellphone.Value = shippingAddress.CellPhone; this.Hiddenshipid.Value = this.shippingid.ToString(); this.regionText.SetWhenIsNotNull(fullRegion); this.region.SetWhenIsNotNull(shippingAddress.RegionId.ToString()); PageTitle.AddSiteNameTitle("编辑收货地址"); }
protected override void AttachChildControls() { this.shipTo = (System.Web.UI.HtmlControls.HtmlInputText) this.FindControl("shipTo"); this.address = (System.Web.UI.HtmlControls.HtmlTextArea) this.FindControl("address"); this.cellphone = (System.Web.UI.HtmlControls.HtmlInputText) this.FindControl("cellphone"); this.Hiddenshipid = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("shipId"); this.regionText = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("regionText"); this.region = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("region"); ShippingAddressInfo shippingAddress = MemberProcessor.GetShippingAddress(this.shippingid); string fullRegion = RegionHelper.GetFullRegion(shippingAddress.RegionId, " "); this.shipTo.Value = shippingAddress.ShipTo; this.address.Value = shippingAddress.Address; this.cellphone.Value = shippingAddress.CellPhone; this.Hiddenshipid.Value = this.shippingid.ToString(); this.regionText.SetWhenIsNotNull(fullRegion); this.region.SetWhenIsNotNull(shippingAddress.RegionId.ToString()); PageTitle.AddSiteNameTitle("编辑收货地址"); }
protected override void AttachChildControls() { PageTitle.AddSiteNameTitle("店铺消息"); this.imglogo = (System.Web.UI.HtmlControls.HtmlImage) this.FindControl("imglogo"); this.hdlogo = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hdlogo"); this.txtstorename = (System.Web.UI.HtmlControls.HtmlInputText) this.FindControl("txtstorename"); this.txtdescription = (System.Web.UI.HtmlControls.HtmlTextArea) this.FindControl("txtdescription"); this.txtacctount = (System.Web.UI.HtmlControls.HtmlInputText) this.FindControl("txtacctount"); this.txtStoreTel = (System.Web.UI.HtmlControls.HtmlInputText) this.FindControl("txtStoreTel"); DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(Globals.GetCurrentMemberUserId(false)); if (userIdDistributors.ReferralStatus != 0) { System.Web.HttpContext.Current.Response.Redirect("MemberCenter.aspx"); } else { MemberInfo currentMember = MemberProcessor.GetCurrentMember(); if (userIdDistributors != null) { if (!string.IsNullOrEmpty(userIdDistributors.Logo)) { this.imglogo.Src = userIdDistributors.Logo; } this.hdlogo.Value = userIdDistributors.Logo; this.txtstorename.Value = userIdDistributors.StoreName; this.txtdescription.Value = userIdDistributors.StoreDescription; this.txtacctount.Value = userIdDistributors.RequestAccount; this.txtStoreTel.Value = currentMember.CellPhone; this.litJs = (System.Web.UI.WebControls.Literal) this.FindControl("litJs"); SiteSettings masterSettings = SettingsManager.GetMasterSettings(true); if (masterSettings.IsShowDistributorSelfStoreName) { this.litJs.Text = "<script>$(function () {$('#idFile').uploadPreview({ Img: 'imglogo', Width: 100, Height: 100 });$('#savemes').removeAttr('disabled');$('.notmodifyshop').show(); });</script>"; } else { this.litJs.Text = "<script>$(function () {$('input,textarea').attr('disabled','true'); });</script>"; } } } }
private void Page_Load(object sender, System.EventArgs e) { System.Web.UI.HtmlControls.HtmlForm frm = (HtmlForm)FindControl("Form1"); GHTTestBegin(frm); GHTSubTestBegin("GHTSubTest1"); try { System.Web.UI.HtmlControls.HtmlTextArea ta = new System.Web.UI.HtmlControls.HtmlTextArea(); ta.Value = "sample text"; GHTActiveSubTest.Controls.Add(ta); } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTSubTestEnd(); GHTTestEnd(); }
protected void Button1_Click(object sender, EventArgs e) { System.Web.UI.HtmlControls.HtmlTextArea htaDemo = (System.Web.UI.HtmlControls.HtmlTextArea)(fb.FindControl("fb")); string msg = htaDemo.Value; string cs = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\database.mdf;Integrated Security=True;User Instance=True"; SqlConnection cn = new SqlConnection(cs); cn.Open(); if (RadioButton1.Checked) { string qr = "insert into feedback values('" + uname.Text + "','" + email.Text + "','" + RadioButton1.Text + "','" + msg + "')"; SqlCommand cmd = new SqlCommand(qr, cn); cmd.ExecuteNonQuery(); cn.Close(); Response.Write("<script language='javascript'>alert('Thanks For Feedback'); </script>"); } else if (RadioButton2.Checked) { string qr = "insert into feedback values('" + uname.Text + "','" + email.Text + "','" + RadioButton2.Text + "','" + msg + "')"; SqlCommand cmd = new SqlCommand(qr, cn); cmd.ExecuteNonQuery(); cn.Close(); Response.Write("<script language='javascript'>alert('Thanks For Feedback'); </script>"); } else if (RadioButton3.Checked) { string qr = "insert into feedback values('" + uname.Text + "','" + email.Text + "','" + RadioButton3.Text + "','" + msg + "')"; SqlCommand cmd = new SqlCommand(qr, cn); cmd.ExecuteNonQuery(); cn.Close(); Response.Write("<script language='javascript'>alert('Thanks For Feedback'); </script>"); } else { Response.Write("<script language='javascript'>alert('Please select feedback type'); </script>"); } RadioButton1.Checked = false; RadioButton2.Checked = false; RadioButton3.Checked = false; fb.InnerText = ""; }
protected override void OnInit(EventArgs e) { Load += new EventHandler(Editor_Load); _textCtl = new HtmlTextArea(); _textCtl.ID = "edit"; _textCtl.Rows = 7; _textCtl.Cols = 40; Controls.Add(_textCtl); /* * m_textCtl = new TextBox(); * m_textCtl.ID = "edit"; * m_textCtl.Height = Unit.Percentage(100); * m_textCtl.Width = Unit.Percentage(99); * m_textCtl.TextMode = TextBoxMode.MultiLine; * Controls.Add( m_textCtl ); */ base.OnInit(e); }
protected override void OnInit(EventArgs e) { this.Page.ClientScript.RegisterClientScriptInclude("TinyMCEInclude", "/jscripts/tiny_mce/tiny_mce.js"); this.Page.ClientScript.RegisterClientScriptBlock(typeof(Edit), "TinyMCESetup", @" tinyMCE.init({ mode : ""textareas"", theme : ""advanced"", theme_advanced_buttons1 : ""bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,undo,redo,link,unlink"", theme_advanced_buttons2 : """", theme_advanced_buttons3 : """", theme_advanced_toolbar_location : ""top"", theme_advanced_toolbar_align : ""left"", theme_advanced_path_location : ""bottom"", extended_valid_elements : ""a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]"" });"); contentText = new HtmlTextArea(); contentText.ID = "contentText"; saveButton = new Button(); saveButton.ID = "saveButton"; // set styles contentText.Cols = 85; contentText.Rows = 30; contentText.Style.Add(HtmlTextWriterStyle.Width, "100%"); contentText.Style.Add(HtmlTextWriterStyle.Height, "600px"); // check to see if content has been defined if (Properties["Content"] != null) contentText.Value = Properties["Content"]; // setup save button saveButton.Text = "Save Page Contents"; saveButton.Click += new EventHandler(contentTextBox_SaveClick); // add to page this.Controls.Add(saveButton); this.Controls.Add(contentText); base.OnInit (e); }
private static void AddShippingAddressTextAreaField(HtmlGenericControl container) { using (HtmlGenericControl shippingAddressDiv = HtmlControlHelper.GetField()) { shippingAddressDiv.ID = "ShippingAddressDiv"; using (HtmlGenericControl label = HtmlControlHelper.GetLabel(Titles.ShippingAddress, "ShippingAddressTextArea")) { shippingAddressDiv.Controls.Add(label); } using (HtmlTextArea shippingAddressTextArea = new HtmlTextArea()) { shippingAddressTextArea.ID = "ShippingAddressTextArea"; shippingAddressTextArea.Attributes.Add("readonly", "readonly"); shippingAddressDiv.Controls.Add(shippingAddressTextArea); } container.Controls.Add(shippingAddressDiv); } }
protected override void AttachChildControls() { PageTitle.AddSiteNameTitle("店铺消息"); this.imglogo = (HtmlImage) this.FindControl("imglogo"); this.litBackImg = (Literal) this.FindControl("litBackImg"); this.hdbackimg = (HtmlInputHidden) this.FindControl("hdbackimg"); this.hdlogo = (HtmlInputHidden) this.FindControl("hdlogo"); this.txtstorename = (HtmlInputText) this.FindControl("txtstorename"); this.txtdescription = (HtmlTextArea) this.FindControl("txtdescription"); DistributorsInfo currentDistributors = DistributorsBrower.GetCurrentDistributors(Globals.GetCurrentMemberUserId()); if (currentDistributors != null) { if (!string.IsNullOrEmpty(currentDistributors.Logo)) { this.imglogo.Src = currentDistributors.Logo; } this.hdbackimg.Value = currentDistributors.BackImage; this.txtstorename.Value = currentDistributors.StoreName; this.txtdescription.Value = currentDistributors.StoreDescription; if (this.litBackImg != null) { List<string> list = SettingsManager.GetMasterSettings(false).DistributorBackgroundPic.Split(new char[] { '|' }).ToList<string>(); foreach (string str in list) { if (!string.IsNullOrEmpty(str)) { if (this.hdbackimg.Value == str) { this.litBackImg.Text = this.litBackImg.Text + "<div class=\"disactive\"><span class=\"mark\"></span><img src=\"" + str + "\"/></div>"; } else { this.litBackImg.Text = this.litBackImg.Text + "<div><span class=\"mark\"></span><img src=\"" + str + "\" /></div>"; } } } } } }
private void AddStatementReferenceTextArea(HtmlGenericControl fields) { using (HtmlGenericControl field = FormHelper.GetField()) { using (HtmlGenericControl label = new HtmlGenericControl()) { label.TagName = "label"; label.Attributes.Add("for", "StatementReferenceTextArea"); label.InnerText = Titles.StatementReference; field.Controls.Add(label); } using (HtmlTextArea statementReferenceTextArea = new HtmlTextArea()) { statementReferenceTextArea.ID = "StatementReferenceTextArea"; statementReferenceTextArea.Rows = 4; field.Controls.Add(statementReferenceTextArea); } fields.Controls.Add(field); } }
protected override void AttachChildControls() { this.litAddresser = (System.Web.UI.WebControls.Literal) this.FindControl("litAddresser"); this.litTitle = (System.Web.UI.WebControls.Literal) this.FindControl("litTitle"); this.litDate = (FormatedTimeLabel)this.FindControl("litDate"); this.txtReplyTitle = (System.Web.UI.WebControls.TextBox) this.FindControl("txtReplyTitle"); this.txtReplyContent = (System.Web.UI.WebControls.TextBox) this.FindControl("txtReplyContent"); this.txtReplyRecord = (System.Web.UI.HtmlControls.HtmlTextArea) this.FindControl("txtReplyRecord"); this.btnReplyReceivedMessage = (System.Web.UI.WebControls.Button) this.FindControl("btnReplyReceivedMessage"); this.btnReplyReceivedMessage.Click += new System.EventHandler(this.btnReplyReceivedMessage_Click); if (!string.IsNullOrEmpty(this.Page.Request.QueryString["MessageId"])) { this.messageId = long.Parse(this.Page.Request.QueryString["MessageId"]); } if (!this.Page.IsPostBack) { CommentBrowser.PostMemberMessageIsRead(this.messageId); MessageBoxInfo memberMessage = CommentBrowser.GetMemberMessage(this.messageId); this.litAddresser.Text = "管理员"; this.litTitle.Text = memberMessage.Title; this.txtReplyRecord.Value = memberMessage.Content; this.litDate.Time = memberMessage.Date; } }
/* * protected void btnsave_Click(object sender, EventArgs e) * { * * string _op = op.Text; * string _b_use_routing = b_use_routing.Text; * * int op_code = Convert.ToInt32(_op.Substring(0, _op.IndexOf('-'))); * string re_sql = ""; * if (op_code < 600 || _b_use_routing == "0") * { * re_sql = @"exec usp_app_bhgp_Apply_V1 '{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}'"; * * } * else if (op_code >= 600 && op_code <= 700) * { * re_sql = @"exec usp_app_bhgp_Apply_QC_V1 '{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}'"; * } * else * { * //ClientScript.RegisterStartupScript(this.GetType(), "showsuccess", "layer.alert('【开发中.....】')", true); * ScriptManager.RegisterStartupScript(Page, this.GetType(), "showsuccess", "layer.alert('【开发中.....】')", true); * return; * } * * re_sql = string.Format(re_sql, emp_code_name.Text, workorder.Text, pgino.Text, pn.Text, descr.Text, op.Text * , qty.Text, reason.Text, comment.Value, _b_use_routing, ref_order.Text); * DataTable re_dt = SQLHelper.Query(re_sql).Tables[0]; * string flag = re_dt.Rows[0][0].ToString(); * string msg = re_dt.Rows[0][1].ToString(); * * if (flag == "N") * { * //ClientScript.RegisterStartupScript(this.GetType(), "showsuccess", "layer.alert('" + msg + "')", true); * ScriptManager.RegisterStartupScript(Page, this.GetType(), "showsuccess", "layer.alert('" + msg + "')", true); * * //Response.Redirect("/workorder/bhgp_Apply_list_V1.aspx?workshop=" + _workshop); * Response.Redirect("/Cjgl1.aspx?workshop=" + _workshop); * } * else * { * //ClientScript.RegisterStartupScript(this.GetType(), "showsuccess", "layer.alert('失败:" + msg + "')", true); * ScriptManager.RegisterStartupScript(Page, this.GetType(), "showsuccess", "layer.alert('失败:" + msg + "')", true); * } * } */ public DataTable Get_Repeat_cz(out string msg) { msg = ""; DataTable dt = new DataTable(); dt.Columns.Add("num", typeof(int)); dt.Columns.Add("cz_qty", typeof(string)); dt.Columns.Add("sy_qty", typeof(string)); dt.Columns.Add("result", typeof(string)); dt.Columns.Add("reason", typeof(string)); dt.Columns.Add("comment", typeof(string)); dt.Columns.Add("workorder_gl", typeof(string)); int i = 0; string msg_row = ""; foreach (RepeaterItem item in listBx_deal.Items) { TextBox txt_num = (TextBox)item.FindControl("num"); TextBox txt_cz_qty = (TextBox)item.FindControl("cz_qty"); TextBox txt_sy_qty = (TextBox)item.FindControl("sy_qty"); TextBox txt_result = (TextBox)item.FindControl("result"); TextBox txt_rscode = (TextBox)item.FindControl("rscode"); TextBox txt_reason = (TextBox)item.FindControl("reason"); TextBox txt_workorder_gl = (TextBox)item.FindControl("workorder_gl"); System.Web.UI.HtmlControls.HtmlTextArea txt_comment = (System.Web.UI.HtmlControls.HtmlTextArea)item.FindControl("comment"); if (txt_result.Text.Trim() != "无法判定") { if (txt_cz_qty.Text.Trim() == "") { msg_row += "第" + (i + 1).ToString() + "组【处置数量】不可为空 <br />"; } else if (Convert.ToSingle(txt_cz_qty.Text.Trim()) <= 0) { msg_row += "第" + (i + 1).ToString() + "组【处置数量】必须大于0 <br />"; } if (txt_sy_qty.Text.Trim() == "") { msg_row += "第" + (i + 1).ToString() + "组【剩余数量】不可为空 <br />"; } else if (Convert.ToSingle(txt_sy_qty.Text.Trim()) < 0) { msg_row += "第" + (i + 1).ToString() + "组【剩余数量】必须大于等于0 <br />"; } if (txt_result.Text.Trim() == "") { msg_row += "第" + (i + 1).ToString() + "组【判断为】不可为空 <br />"; } else if (txt_result.Text.Trim() == "不合格") { if (txt_reason.Text.Trim() == "") { msg_row += "第" + (i + 1).ToString() + "组【废品原因】不可为空 <br />"; } else { if (txt_rscode.Text.Trim() != "") { var _reason = txt_reason.Text.Trim().Substring(0, txt_reason.Text.Trim().IndexOf('-')); if (_reason != txt_rscode.Text.Trim()) { msg_row += "第" + (i + 1).ToString() + "组【原因名称】与【代码】不匹配 <br />"; } } } } if (txt_workorder_gl.Text.Trim() == "") { msg_row += "第" + (i + 1).ToString() + "组【关联单号】不可为空 <br />"; } else if (txt_workorder_gl.Text.Trim().Length != 8) { msg_row += "第" + (i + 1).ToString() + "组【关联单号】长度必须8位 <br />"; } else if (txt_workorder_gl.Text.Trim() == workorder_qc.Text) { msg_row += "第" + (i + 1).ToString() + "组【关联单号】不可为" + laiyuan_dh_desc.Text + workorder_qc.Text + " <br />"; } } else { if (i != 0) { msg_row += "第" + (i + 1).ToString() + "组【判断为】不可为【无法判定】 <br />"; } } if (msg_row == "")//此行正确,添加到datatable { DataRow dr_s = dt.NewRow(); dr_s["num"] = txt_num.Text; dr_s["cz_qty"] = txt_cz_qty.Text.Trim(); dr_s["sy_qty"] = txt_sy_qty.Text.Trim(); dr_s["result"] = txt_result.Text.Trim(); dr_s["reason"] = txt_reason.Text.Trim(); dr_s["comment"] = txt_comment.Value.Trim(); dr_s["workorder_gl"] = txt_workorder_gl.Text.Trim(); dt.Rows.Add(dr_s); } msg += msg_row;//累计msg信息 i++; msg_row = ""; } return(dt); }
private String PrettyPrint(String xml) { String result = null; MemoryStream memoryStream = new MemoryStream(); XmlTextWriter writer = new XmlTextWriter(memoryStream, Encoding.UTF8); XmlDocument document = new XmlDocument(); try { document.LoadXml(xml); writer.Formatting = Formatting.Indented; document.WriteContentTo(writer); writer.Flush(); memoryStream.Position = 0; StreamReader reader = new StreamReader(memoryStream); result = reader.ReadToEnd(); } finally { writer.Close(); } return result; }
private void InitOption(int subjectId) { System.Collections.Generic.List<Model.VoteOptionsInfo> list = new Business.VoteOptions().GetItemsBySubjectId(subjectId); Table t = new Table(); t.ID = "tablePollOption"; t.Attributes.Add("class", "PollTable"); TableRow row = new TableRow(); TableCell cell = new TableCell(); //row.Attributes.Add("class", "t"); int i = 1; foreach (XYECOM.Model.VoteOptionsInfo option in list) { row = new TableRow(); cell = new TableCell(); cell.Text = i + "."; row.Cells.Add(cell); cell = new TableCell(); //Option Body HtmlTextArea txt = new HtmlTextArea(); txt.Rows = 2; txt.Cols = 60; txt.ID = "option" + i; txt.Value = option.Text; cell.Controls.Add(txt); //Option Id HtmlInputHidden hidden = new HtmlInputHidden(); hidden.ID = "option_id_" + i; hidden.Value = option.OptionId.ToString(); cell.Controls.Add(hidden); row.Cells.Add(cell); cell = new TableCell(); cell.ID = "tdDel_" + i; if (i == list.Count && i != 1) cell.Attributes.Add("style", "display:;"); else cell.Attributes.Add("style", "display:none;"); cell.Text = "<a href=\"#\" onclick=\"DeletePollOption(" + i + ");DeleteServerOption('" + option.OptionId + "');\"><img src=\"../images/delete1.gif\" alt=\"删除\" border=\"0\"/></a>"; row.Cells.Add(cell); t.Rows.Add(row); i++; } this.OptionTotal.Value = list.Count.ToString(); phOptions.Controls.Add(t); }
public void btnRefer_Click(object sender, System.EventArgs e) { if (!this.ValidateConvert()) { return; } System.Collections.Generic.Dictionary <string, string> dictionary = new System.Collections.Generic.Dictionary <string, string>(); foreach (System.Web.UI.WebControls.RepeaterItem repeaterItem in this.orderItems.Items) { System.Web.UI.HtmlControls.HtmlTextArea htmlTextArea = repeaterItem.FindControl("txtcontent") as System.Web.UI.HtmlControls.HtmlTextArea; System.Web.UI.HtmlControls.HtmlInputHidden htmlInputHidden = repeaterItem.FindControl("hdproductId") as System.Web.UI.HtmlControls.HtmlInputHidden; if (!string.IsNullOrEmpty(htmlTextArea.Value.Trim()) && !string.IsNullOrEmpty(htmlInputHidden.Value.Trim())) { dictionary.Add(htmlInputHidden.Value, htmlTextArea.Value); } } if (dictionary.Count <= 0) { this.ShowMessage("请输入评价内容呀!", false); return; } string text = ""; foreach (System.Collections.Generic.KeyValuePair <string, string> current in dictionary) { int productId = System.Convert.ToInt32(current.Key.Split(new char[] { '&' })[0].ToString()); string value = current.Value; string skuId = current.Key.Split(new char[] { '&' })[2].ToString(); ProductReviewInfo productReviewInfo = new ProductReviewInfo(); productReviewInfo.ReviewDate = System.DateTime.Now; productReviewInfo.ProductId = productId; productReviewInfo.UserId = HiContext.Current.User.UserId; productReviewInfo.UserName = HiContext.Current.User.Username; productReviewInfo.UserEmail = HiContext.Current.User.Email; productReviewInfo.ReviewText = value; productReviewInfo.OrderID = this.orderId; productReviewInfo.SkuId = skuId; ValidationResults validationResults = Validation.Validate <ProductReviewInfo>(productReviewInfo, new string[] { "Refer" }); text = string.Empty; if (!validationResults.IsValid) { using (System.Collections.Generic.IEnumerator <ValidationResult> enumerator3 = ((System.Collections.Generic.IEnumerable <ValidationResult>)validationResults).GetEnumerator()) { while (enumerator3.MoveNext()) { ValidationResult current2 = enumerator3.Current; text += Formatter.FormatErrorMessage(current2.Message); } break; } } if (ProductBrowser.GetProductSimpleInfo(productId) == null) { text = "您要评论的商品已经不存在"; break; } if (!ProductBrowser.InsertProductReview(productReviewInfo)) { text = "评论失败,请重试"; break; } } if (text != "") { this.ShowMessage(text, false); return; } this.Page.ClientScript.RegisterClientScriptBlock(base.GetType(), "success", string.Format("<script>alert(\"{0}\");window.location.href=\"{1}\"</script>", "评论成功", Globals.GetSiteUrls().UrlData.FormatUrl("user_UserProductReviews"))); }
protected override void OnLoad(EventArgs e) { AddStyles(); Control banner = AddDiv(Body, null); banner.ID = "banner"; AddGeneric(banner, "h1", null, Title); Control content = AddDiv(Body, null); content.ID = "content"; string summary = JsonRpcHelpAttribute.GetText(ServiceDescriptor.AttributeProvider); if (summary.Length > 0) AddGeneric(content, "span", "service-help", summary); Control form = AddGeneric(content, "form"); form.ID = "TestForm"; Control selectionPara = AddPara(form, null, "Select method to test: "); HtmlSelect methodSelector = new HtmlSelect(); methodSelector.ID = "Method"; methodSelector.Attributes.Add("onchange", "return Method_onchange(this)"); foreach (IRpcMethodDescriptor method in SortedMethods) methodSelector.Items.Add(method.Name); selectionPara.Controls.Add(methodSelector); HtmlInputButton testButton = new HtmlInputButton(); testButton.ID = "Test"; testButton.Value = "Test"; testButton.Attributes["onclick"] = "return Test_onclick(this)"; testButton.Attributes["accesskey"] = "T"; selectionPara.Controls.Add(new LiteralControl(" ")); selectionPara.Controls.Add(testButton); selectionPara.Controls.Add(new LiteralControl(" ")); HyperLink helpLink = new HyperLink(); helpLink.Text = "Help"; helpLink.NavigateUrl = Request.FilePath + "?help"; selectionPara.Controls.Add(helpLink); Control requestPara = AddPara(form, null, "Request: "); HtmlTextArea requestArea = new HtmlTextArea(); requestArea.ID = "Request"; requestArea.Rows = 10; requestArea.Attributes.Add("title", "Enter the array of parameters (in JSON) to send in the RPC request."); requestPara.Controls.Add(requestArea); Control responsePara = AddPara(form, null, "Response: "); HtmlTextArea responseArea = new HtmlTextArea(); responseArea.ID = "Response"; responseArea.Rows = 10; responseArea.Attributes.Add("readonly", "readonly"); responseArea.Attributes.Add("title", "The result or error object (in JSON) from the last RPC response."); responsePara.Controls.Add(responseArea); Control timingPara = AddPara(content, null, null); timingPara.ID = "timing"; AddScriptInclude((Request.ApplicationPath.Equals("/") ? string.Empty : Request.ApplicationPath) + "/json.js"); AddScriptBlock(@" var callTemplates = " + BuildCallTemplatesObject() + @"; var theForm = null; var nextRequestId = 0; window.onload = function() { theForm = document.forms[0]; Method_onchange(theForm.Method); } function Method_onchange(sender) { theForm.Request.value = callTemplates[sender.options[sender.selectedIndex].value]; } function Test_onclick(sender) { var form = theForm; try { var request = { id : ++nextRequestId, method : form.Method.value, params : JSON.parse(theForm.Request.value) }; form.Response.value = ''; form.Response.className = ''; var response = callSync(request); form.Response.value = JSON.stringify(response); } catch (e) { form.Response.className = 'error'; form.Response.value = JSON.stringify(e); alert(e.message); } } function callSync(request) { var clockStart = new Date(); var http = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest(); http.open('POST', '" + Request.FilePath + @"', false); http.setRequestHeader('Content-Type', 'text/plain; charset=utf-8'); http.setRequestHeader('X-JSON-RPC', request.method); http.send(JSON.stringify(request)); if (http.status != 200) throw { message : http.status + ' ' + http.statusText, toString : function() { return message; } }; var response = JSON.eval(http.responseText); var timeTaken = (new Date()) - clockStart; var timing = document.getElementById('timing'); var timingText = document.createTextNode('Time taken = ' + (timeTaken / 1000).toFixed(4) + ' milliseconds.'); if (timing.firstChild == null) timing.appendChild(timingText); else timing.replaceChild(timingText, timing.firstChild); if (response.error != null) throw response.error; return response.result; } "); base.OnLoad(e); }
private void SaveHTMLInfo2(HtmlTextArea mrk2, string filename) { try { if ((m_news_id > 0)) { string strHTMLFileLocation; string strFileName; string strHTMLContent; StreamWriter fsoFile; strFileName = PathFiles.GetPathNews(m_news_id) + "/" + filename; strHTMLFileLocation = Server.MapPath(strFileName); strHTMLContent = mrk2.Value; fsoFile = File.CreateText(strHTMLFileLocation); fsoFile.Write(strHTMLContent); fsoFile.Close(); } } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } }
private void Dispose(bool disposing) { if (!disposing) { return; } if (this.dateTextBox != null) { this.dateTextBox.Dispose(); this.dateTextBox = null; } if (this.itemCodeHidden != null) { this.itemCodeHidden.Dispose(); this.itemCodeHidden = null; } if (this.itemIdHidden != null) { this.itemIdHidden.Dispose(); this.itemIdHidden = null; } if (this.modeHidden != null) { this.modeHidden.Dispose(); this.modeHidden = null; } if (this.partyCodeHidden != null) { this.partyCodeHidden.Dispose(); this.partyCodeHidden = null; } if (this.partyCodeInputText != null) { this.partyCodeInputText.Dispose(); this.partyCodeInputText = null; } if (this.partyIdHidden != null) { this.partyIdHidden.Dispose(); this.partyIdHidden = null; } if (this.priceTypeIdHidden != null) { this.priceTypeIdHidden.Dispose(); this.priceTypeIdHidden = null; } if (this.productGridViewDataHidden != null) { this.productGridViewDataHidden.Dispose(); this.productGridViewDataHidden = null; } if (this.referenceNumberInputText != null) { this.referenceNumberInputText.Dispose(); this.referenceNumberInputText = null; } if (this.statementReferenceTextArea != null) { this.statementReferenceTextArea.Dispose(); this.statementReferenceTextArea = null; } if (this.salesPersonIdHidden != null) { this.salesPersonIdHidden.Dispose(); this.salesPersonIdHidden = null; } if (this.shipperIdHidden != null) { this.shipperIdHidden.Dispose(); this.shipperIdHidden = null; } if (this.shippingAddressCodeHidden != null) { this.shippingAddressCodeHidden.Dispose(); this.shippingAddressCodeHidden = null; } if (this.storeIdHidden != null) { this.storeIdHidden.Dispose(); this.storeIdHidden = null; } if (this.title != null) { this.title.Dispose(); this.title = null; } if (this.tranIdCollectionHidden != null) { this.tranIdCollectionHidden.Dispose(); this.tranIdCollectionHidden = null; } if (this.unitIdHidden != null) { this.unitIdHidden.Dispose(); this.unitIdHidden = null; } if (this.unitNameHidden != null) { this.unitNameHidden.Dispose(); this.unitNameHidden = null; } if (this.placeHolder != null) { this.placeHolder.Dispose(); this.placeHolder = null; } this.disposed = true; }
public void Name () { HtmlTextArea ta = new HtmlTextArea (); Assert.IsNull (ta.ID, "ID"); ta.Name = "name"; Assert.IsNull (ta.Name, "Name"); ta.ID = "id"; Assert.AreEqual ("id", ta.ID, "ID-2"); Assert.AreEqual ("id", ta.Name, "Name-ID"); ta.Name = "name"; Assert.AreEqual ("id", ta.Name, "Name-ID-2"); ta.ID = null; Assert.IsNull (ta.ID, "ID-3"); Assert.IsNull (ta.Name, "Name-2"); }
protected void Page_Init(object sender, EventArgs e) { formDocument = new Document(Convert.ToInt32(HttpContext.Current.Request.QueryString["id"])); template = new Template(formDocument.Template); h1 = new HtmlGenericControl("h1"); h1.InnerHtml = "Simple Forms"; settings.Controls.Add(h1); saveBox = new HtmlTextArea(); saveBox.Attributes["class"] = "saveBox"; settings.Controls.Add(saveBox); formIDBox = new TextBox(); formIDBox.Attributes["class"] = "formIDbox"; settings.Controls.Add(formIDBox); actionBox = new TextBox(); actionBox.Attributes["class"] = "actionBox"; settings.Controls.Add(actionBox); table = new HtmlGenericControl("table"); table.Attributes["class"] = "settingsTable"; settings.Controls.Add(table); //template ddl templateDdl = new DropDownList(); templateDdl.CssClass = "template"; tr = new HtmlGenericControl("tr"); table.Controls.Add(tr); td = new HtmlGenericControl("td"); td.InnerText = t("Template"); tr.Controls.Add(td); td = new HtmlGenericControl("td"); td.Controls.Add(templateDdl); tr.Controls.Add(td); documentType = new DocumentType(formDocument.ContentType.Id); bool optionSelected = false; foreach (Template thisTemplate in documentType.allowedTemplates) { ListItem option = new ListItem(thisTemplate.Text, thisTemplate.Id.ToString()); if(formDocument.Template==thisTemplate.Id&&optionSelected==false){ option.Selected=true; optionSelected = true; } templateDdl.Items.Add(option); } //form name formName = new TextBox(); formName.Attributes["class"] = "formName"; settings.Controls.Add(formName); tr = new HtmlGenericControl("tr"); table.Controls.Add(tr); td = new HtmlGenericControl("td"); td.InnerText = t("Name"); tr.Controls.Add(td); td = new HtmlGenericControl("td"); td.Controls.Add(formName); tr.Controls.Add(td); //url tr = new HtmlGenericControl("tr"); table.Controls.Add(tr); td = new HtmlGenericControl("td"); td.InnerText = t("Url"); tr.Controls.Add(td); urlTD = new HtmlGenericControl("td"); tr.Controls.Add(urlTD); //statusTD tr = new HtmlGenericControl("tr"); table.Controls.Add(tr); td = new HtmlGenericControl("td"); td.InnerText = t("Status"); tr.Controls.Add(td); statusTD = new HtmlGenericControl("td"); statusTD.InnerHtml = (formDocument.Published) ? "Published" : "Unpublished"; tr.Controls.Add(statusTD); saveMessages.Attributes["class"] = "saveMessages"; }
public void insertcomment(TableCell allcells) { Table tblComments = new Table(); tblComments.Width = Unit.Percentage(100); TableRow tblrowcom = new TableRow(); TableCell tblcellcom = new TableCell(); tblComments.Style.Add("background-color", "#EDEFF4"); System.Web.UI.HtmlControls.HtmlTextArea hta = new System.Web.UI.HtmlControls.HtmlTextArea(); hta.InnerText = "write a comment"; hta.Rows = 4; hta.Cols = 30; tblcellcom.Controls.Add(hta); tblrowcom.Cells.Add(tblcellcom); tblComments.Controls.Add(tblrowcom); allcells.Controls.Add(tblComments); }
private void InitOption(List<XYECOM.Model.PollOptionInfo> infos) { Table t = new Table(); t.ID = "tablePollOption"; t.Attributes.Add("class", "PollTable"); TableRow row = new TableRow(); TableCell cell = new TableCell(); //row.Attributes.Add("class", "t"); int i = 1; foreach (XYECOM.Model.PollOptionInfo option in infos) { row = new TableRow(); cell = new TableCell(); cell.Text = i+ "."; row.Cells.Add(cell); cell = new TableCell(); //Option Body HtmlTextArea txt = new HtmlTextArea(); txt.Rows = 2; txt.Cols = 60; txt.ID = "option" + i; txt.Value = option.Option; cell.Controls.Add(txt); //Option Id HtmlInputHidden hidden = new HtmlInputHidden(); hidden.ID = "option_id_" + i; hidden.Value = option.OptionId.ToString(); cell.Controls.Add(hidden); row.Cells.Add(cell); cell = new TableCell(); cell.ID = "tdDel_" +i; if (i == infos.Count && i != 1) cell.Attributes.Add("style", "display:;"); else cell.Attributes.Add("style", "display:none;"); cell.Text = "<a href=\"#\" onclick=\"DeletePollOption(" + i + ");DeleteServerOption('"+option.OptionId+"');\"><img src=\"../images/delete1.gif\" alt=\"ɾ��\" border=\"0\"/></a>"; row.Cells.Add(cell); t.Rows.Add(row); i++; } this.OptionTotal.Value = infos.Count.ToString(); phMain.Controls.Add(t); }
private void CreateOtherField(int _channel_id) { List<Model.article_attribute_field> ls = new BLL.article_attribute_field().GetModelList(this.channel_id, "is_sys=0"); if (ls.Count > 0) { field_tab_item.Visible = true; field_tab_content.Visible = true; } foreach (Model.article_attribute_field modelt in ls) { //创建一个dl标签 HtmlGenericControl htmlDL = new HtmlGenericControl("dl"); HtmlGenericControl htmlDT = new HtmlGenericControl("dt"); HtmlGenericControl htmlDD = new HtmlGenericControl("dd"); htmlDT.InnerHtml = modelt.title; switch (modelt.control_type) { case "single-text": //单行文本 //创建一个TextBox控件 TextBox txtControl = new TextBox(); txtControl.ID = "field_control_" + modelt.name; //CSS样式及TextMode设置 if (modelt.control_type == "single-text") //单行 { txtControl.CssClass = "input normal"; //是否密码框 if (modelt.is_password == 1) { txtControl.TextMode = TextBoxMode.Password; } } else if (modelt.control_type == "multi-text") //多行 { txtControl.CssClass = "input"; txtControl.TextMode = TextBoxMode.MultiLine; } else if (modelt.control_type == "number") //数字 { txtControl.CssClass = "input small"; } else if (modelt.control_type == "images") //图片 { txtControl.CssClass = "input normal upload-path"; } //设置默认值 txtControl.Text = modelt.default_value; //验证提示信息 if (!string.IsNullOrEmpty(modelt.valid_tip_msg)) { txtControl.Attributes.Add("tipmsg", modelt.valid_tip_msg); } //验证失败提示信息 if (!string.IsNullOrEmpty(modelt.valid_error_msg)) { txtControl.Attributes.Add("errormsg", modelt.valid_error_msg); } //验证表达式 if (!string.IsNullOrEmpty(modelt.valid_pattern)) { txtControl.Attributes.Add("datatype", modelt.valid_pattern); txtControl.Attributes.Add("sucmsg", " "); } //创建一个Label控件 Label labelControl = new Label(); labelControl.CssClass = "Validform_checktip"; labelControl.Text = modelt.valid_tip_msg; //将控件添加至DD中 htmlDD.Controls.Add(txtControl); //如果是图片则添加上传按钮 if (modelt.control_type == "images") { HtmlGenericControl htmlBtn = new HtmlGenericControl("div"); htmlBtn.Attributes.Add("class", "upload-box upload-img"); htmlBtn.Attributes.Add("style", "margin-left:4px;"); htmlDD.Controls.Add(htmlBtn); } htmlDD.Controls.Add(labelControl); break; case "multi-text": //多行文本 goto case "single-text"; case "editor": //编辑器 HtmlTextArea txtTextArea = new HtmlTextArea(); txtTextArea.ID = "field_control_" + modelt.name; txtTextArea.Attributes.Add("style", "visibility:hidden;"); //是否简洁型编辑器 if (modelt.editor_type == 1) { txtTextArea.Attributes.Add("class", "editor-mini"); } else { txtTextArea.Attributes.Add("class", "editor"); } txtTextArea.Value = modelt.default_value; //默认值 //验证提示信息 if (!string.IsNullOrEmpty(modelt.valid_tip_msg)) { txtTextArea.Attributes.Add("tipmsg", modelt.valid_tip_msg); } //验证失败提示信息 if (!string.IsNullOrEmpty(modelt.valid_error_msg)) { txtTextArea.Attributes.Add("errormsg", modelt.valid_error_msg); } //验证表达式 if (!string.IsNullOrEmpty(modelt.valid_pattern)) { txtTextArea.Attributes.Add("datatype", modelt.valid_pattern); txtTextArea.Attributes.Add("sucmsg", " "); } //创建一个Label控件 Label labelControl2 = new Label(); labelControl2.CssClass = "Validform_checktip"; labelControl2.Text = modelt.valid_tip_msg; //将控件添加至DD中 htmlDD.Controls.Add(txtTextArea); htmlDD.Controls.Add(labelControl2); break; case "images": //图片上传 goto case "single-text"; case "number": //数字 goto case "single-text"; case "checkbox": //复选框 CheckBox cbControl = new CheckBox(); cbControl.ID = "field_control_" + modelt.name; //默认值 if (modelt.default_value == "1") { cbControl.Checked = true; } HtmlGenericControl htmlDiv1 = new HtmlGenericControl("div"); htmlDiv1.Attributes.Add("class", "rule-single-checkbox"); htmlDiv1.Controls.Add(cbControl); //将控件添加至DD中 htmlDD.Controls.Add(htmlDiv1); if (!string.IsNullOrEmpty(modelt.valid_tip_msg)) { //创建一个Label控件 Label labelControl3 = new Label(); labelControl3.CssClass = "Validform_checktip"; labelControl3.Text = modelt.valid_tip_msg; htmlDD.Controls.Add(labelControl3); } break; case "multi-radio": //多项单选 RadioButtonList rblControl = new RadioButtonList(); rblControl.ID = "field_control_" + modelt.name; rblControl.RepeatDirection = RepeatDirection.Horizontal; rblControl.RepeatLayout = RepeatLayout.Flow; HtmlGenericControl htmlDiv2 = new HtmlGenericControl("div"); htmlDiv2.Attributes.Add("class", "rule-multi-radio"); htmlDiv2.Controls.Add(rblControl); //赋值选项 string[] valArr = modelt.item_option.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None); for (int i = 0; i < valArr.Length; i++) { string[] valItemArr = valArr[i].Split('|'); if (valItemArr.Length == 2) { rblControl.Items.Add(new ListItem(valItemArr[0], valItemArr[1])); } } rblControl.SelectedValue = modelt.default_value; //默认值 //创建一个Label控件 Label labelControl4 = new Label(); labelControl4.CssClass = "Validform_checktip"; labelControl4.Text = modelt.valid_tip_msg; //将控件添加至DD中 htmlDD.Controls.Add(htmlDiv2); htmlDD.Controls.Add(labelControl4); break; case "multi-checkbox": //多项多选 CheckBoxList cblControl = new CheckBoxList(); cblControl.ID = "field_control_" + modelt.name; cblControl.RepeatDirection = RepeatDirection.Horizontal; cblControl.RepeatLayout = RepeatLayout.Flow; HtmlGenericControl htmlDiv3 = new HtmlGenericControl("div"); htmlDiv3.Attributes.Add("class", "rule-multi-checkbox"); htmlDiv3.Controls.Add(cblControl); //赋值选项 string[] valArr2 = modelt.item_option.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None); for (int i = 0; i < valArr2.Length; i++) { string[] valItemArr2 = valArr2[i].Split('|'); if (valItemArr2.Length == 2) { cblControl.Items.Add(new ListItem(valItemArr2[0], valItemArr2[1])); } } cblControl.SelectedValue = modelt.default_value; //默认值 //创建一个Label控件 Label labelControl5 = new Label(); labelControl5.CssClass = "Validform_checktip"; labelControl5.Text = modelt.valid_tip_msg; //将控件添加至DD中 htmlDD.Controls.Add(htmlDiv3); htmlDD.Controls.Add(labelControl5); break; } //将DT和DD添加到DL中 htmlDL.Controls.Add(htmlDT); htmlDL.Controls.Add(htmlDD); //将DL添加至field_tab_content中 field_tab_content.Controls.Add(htmlDL); } }
protected override void OnInit( EventArgs e ) { Load += new EventHandler( Editor_Load ); _textCtl = new HtmlTextArea(); _textCtl.ID = "edit"; _textCtl.Rows = 7; _textCtl.Cols = 40; Controls.Add( _textCtl ); /* m_textCtl = new TextBox(); m_textCtl.ID = "edit"; m_textCtl.Height = Unit.Percentage(100); m_textCtl.Width = Unit.Percentage(99); m_textCtl.TextMode = TextBoxMode.MultiLine; Controls.Add( m_textCtl ); */ base.OnInit( e ); }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Init" /> event. /// </summary> /// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param> protected override void OnInit([NotNull] EventArgs e) { this.PreRender += this.Editor_PreRender; this._textCtl = new HtmlTextArea { ID = "YafTextEditor", Rows = 15, Cols = 100 }; this._textCtl.Attributes.Add("class", "YafTextEditor form-control"); this.AddEditorControl(this._textCtl); base.OnInit(e); }
public DataTable Get_Repeat_cz(out string msg) { msg = ""; DataTable dt = new DataTable(); dt.Columns.Add("num", typeof(int)); dt.Columns.Add("cz_qty", typeof(string)); dt.Columns.Add("sy_qty", typeof(string)); dt.Columns.Add("result", typeof(string)); dt.Columns.Add("reason", typeof(string)); dt.Columns.Add("comment", typeof(string)); int i = 0; string msg_row = ""; foreach (RepeaterItem item in listBx_deal.Items) { TextBox txt_num = (TextBox)item.FindControl("num"); TextBox txt_cz_qty = (TextBox)item.FindControl("cz_qty"); TextBox txt_sy_qty = (TextBox)item.FindControl("sy_qty"); TextBox txt_result = (TextBox)item.FindControl("result"); TextBox txt_reason = (TextBox)item.FindControl("reason"); System.Web.UI.HtmlControls.HtmlTextArea txt_comment = (System.Web.UI.HtmlControls.HtmlTextArea)item.FindControl("comment"); if (txt_cz_qty.Text.Trim() == "") { msg_row += "第" + (i + 1).ToString() + "组【处置数量】不可为空 <br />"; } else if (Convert.ToInt32(txt_cz_qty.Text.Trim()) <= 0) { msg_row += "第" + (i + 1).ToString() + "组【处置数量】必须大于0 <br />"; } if (txt_sy_qty.Text.Trim() == "") { msg_row += "第" + (i + 1).ToString() + "组【剩余数量】不可为空 <br />"; } else if (Convert.ToInt32(txt_sy_qty.Text.Trim()) < 0) { msg_row += "第" + (i + 1).ToString() + "组【剩余数量】必须大于等于0 <br />"; } if (txt_result.Text.Trim() == "") { msg_row += "第" + (i + 1).ToString() + "组【判断为】不可为空 <br />"; } else if (txt_result.Text.Trim() == "不合格") { if (txt_reason.Text.Trim() == "") { msg_row += "第" + (i + 1).ToString() + "组【废品原因】不可为空 <br />"; } } if (msg_row == "")//此行正确,添加到datatable { DataRow dr_s = dt.NewRow(); dr_s["num"] = txt_num.Text; dr_s["cz_qty"] = txt_cz_qty.Text.Trim(); dr_s["sy_qty"] = txt_sy_qty.Text.Trim(); dr_s["result"] = txt_result.Text.Trim(); dr_s["reason"] = txt_reason.Text.Trim(); dr_s["comment"] = txt_comment.Value.Trim(); dt.Rows.Add(dr_s); } msg += msg_row;//累计msg信息 i++; msg_row = ""; } return(dt); }
protected void GenerateProductTypePropertyFields() { ProductTypePropertiesLiteral.Text = ""; if (lstProductType.SelectedValue.Trim() != string.Empty) { string productTypeBvin = lstProductType.SelectedValue; List<ProductProperty> props = MTApp.CatalogServices.ProductPropertiesFindForType(productTypeBvin); StringBuilder sb = new StringBuilder(); int count = 0; foreach (ProductProperty item in props) { count += 1; StringWriter sw = new StringWriter(); HtmlTextWriter writer = new HtmlTextWriter(sw); sb.Append("<tr><td class=\"formlabel\">"); sb.Append(item.DisplayName); sb.Append("</td><td class=\"formfield\">"); if (item.TypeCode == ProductPropertyType.CurrencyField) { HtmlInputText input = new HtmlInputText(); input.ID = "ProductTypeProperty" + count.ToString(); if (ProductTypeProperties.Count > (count - 1)) { if (ProductTypeProperties[count - 1] != null) { input.Value = ProductTypeProperties[count - 1]; } else { input.Value = item.DefaultValue; } } else { input.Value = item.DefaultValue; } input.RenderControl(writer); writer.Flush(); sb.Append(sw.ToString()); } else if (item.TypeCode == ProductPropertyType.DateField) { HtmlInputText input = new HtmlInputText(); input.ID = "ProductTypeProperty" + count.ToString(); if (ProductTypeProperties.Count > (count - 1)) { if (ProductTypeProperties[count - 1] != null) { input.Value = ProductTypeProperties[count - 1]; } else { input.Value = item.DefaultValue; } } else { input.Value = item.DefaultValue; } input.RenderControl(writer); writer.Flush(); sb.Append(sw.ToString()); } else if (item.TypeCode == ProductPropertyType.HyperLink) { HtmlInputText input = new HtmlInputText(); input.ID = "ProductTypeProperty" + count.ToString(); if (ProductTypeProperties.Count > (count - 1)) { if (ProductTypeProperties[count - 1] != null) { input.Value = ProductTypeProperties[count - 1]; } else { input.Value = item.DefaultValue; } } else { input.Value = item.DefaultValue; } input.RenderControl(writer); writer.Flush(); sb.Append(sw.ToString()); } else if (item.TypeCode == ProductPropertyType.MultipleChoiceField) { HtmlSelect input = new HtmlSelect(); input.ID = "ProductTypeProperty" + count.ToString(); bool setWidth = false; foreach (ProductPropertyChoice choice in item.Choices) { if (choice.ChoiceName.Length > 25) { setWidth = true; } System.Web.UI.WebControls.ListItem li = new System.Web.UI.WebControls.ListItem(choice.ChoiceName, choice.Id.ToString()); input.Items.Add(li); } if (setWidth) { input.Style.Add("width", "305px"); } if (ProductTypeProperties.Count > (count - 1)) { if (ProductTypeProperties[count - 1] != null) { input.Value = ProductTypeProperties[count - 1]; } else { input.Value = item.DefaultValue; } } else { input.Value = item.DefaultValue; } input.RenderControl(writer); writer.Flush(); sb.Append(sw.ToString()); } else if (item.TypeCode == ProductPropertyType.TextField) { HtmlTextArea input = new HtmlTextArea(); input.ID = "ProductTypeProperty" + count.ToString(); if (ProductTypeProperties.Count > (count - 1)) { if (ProductTypeProperties[count - 1] != null) { input.Value = ProductTypeProperties[count - 1]; } else { input.Value = item.DefaultValue; } } else { input.Value = item.DefaultValue; } input.Rows = 5; input.Cols = 40; input.RenderControl(writer); writer.Flush(); sb.Append(sw.ToString()); } sb.Append("</td></tr>"); ProductTypePropertiesLiteral.Text = sb.ToString(); } } }
private void AddSamlTokenTable(HtmlControl container) { HtmlTable table = CreateTable(container); var tokenVisualizer = TokenVisualizerFactory.GetTokenVisualizer( ((IClaimsPrincipal)Thread.CurrentPrincipal).GetBootstrapTokens().First()); AddTableSectionHeader(table, Resources.SamlToken, string.Empty); string tokenTextAreaId = string.Format(CultureInfo.InvariantCulture, "{0}_samlToken", this.ID); HtmlTextArea tokenTextArea = new HtmlTextArea() { ID = tokenTextAreaId, InnerText = tokenVisualizer.SecurityTokenString }; tokenTextArea.Attributes["class"] = "SAMLToken"; tokenTextArea.Attributes["readonly"] = "true"; HtmlControl samlTokenHeader = this.CreateCollapsableHeader(Resources.RawSamlToken, tokenTextArea, false /* Expanded as Default */); HtmlTableRow row = new HtmlTableRow(); HtmlTableCell tokenCell = new HtmlTableCell { ColSpan = TableColumnsQuantity }; tokenCell.Controls.Add(samlTokenHeader); tokenCell.Controls.Add(tokenTextArea); row.Cells.Add(tokenCell); table.Rows.Add(row); AddColumnHeadersToTable(table, new[] { Resources.TokenPropertyName, Resources.TokenPropertyValue }); foreach (var entry in tokenVisualizer.RetrieveTokenProperties()) { AddTokenProperty(table, entry.Key, entry.Value); } }
private void showFileHTML2(ref HtmlTextArea mrk2, string filename) { string pathFile; string strHTMLContent; if (m_news_id > 0) { var newsInfo = DB.GetTable<ESHOP_NEW>().Where(n => n.NEWS_ID == m_news_id); pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + filename); if ((File.Exists(pathFile))) { StreamReader objNewsReader; objNewsReader = new StreamReader(pathFile); strHTMLContent = objNewsReader.ReadToEnd(); objNewsReader.Close(); mrk2.Value = strHTMLContent; } } }
protected override void AddContent() { Control content = AddDiv(Body, null); content.ID = "Content"; if (ServiceClass.Description.Length > 0) AddGeneric(content, "span", "service-help", ServiceClass.Description); Control form = AddGeneric(content, "form"); form.ID = "TestForm"; Control selectionPara = AddPara(form, null, "Select method to test: "); HtmlSelect methodSelector = new HtmlSelect(); methodSelector.ID = "Method"; methodSelector.Attributes.Add("onchange", "return Method_onchange(this)"); foreach (JsonRpcMethod method in SortedMethods) methodSelector.Items.Add(method.Name); selectionPara.Controls.Add(methodSelector); HtmlInputButton testButton = new HtmlInputButton(); testButton.ID = "Test"; testButton.Value = "Test"; testButton.Attributes["onclick"] = "return Test_onclick(this)"; testButton.Attributes["accesskey"] = "T"; selectionPara.Controls.Add(new LiteralControl(" ")); selectionPara.Controls.Add(testButton); selectionPara.Controls.Add(new LiteralControl(" ")); HyperLink helpLink = new HyperLink(); helpLink.Text = "Help"; helpLink.NavigateUrl = Request.FilePath + "?help"; selectionPara.Controls.Add(helpLink); Control requestPara = AddPara(form, null, "Request parameters: "); HtmlTextArea requestArea = new HtmlTextArea(); requestArea.ID = "Request"; requestArea.Rows = 10; requestArea.Attributes.Add("title", "Enter the array of parameters (in JSON) to send in the RPC request."); requestPara.Controls.Add(requestArea); Control responsePara = AddPara(form, null, "Response result/error: "); HtmlTextArea responseArea = new HtmlTextArea(); responseArea.ID = "Response"; responseArea.Rows = 10; responseArea.Attributes.Add("readonly", "readonly"); responseArea.Attributes.Add("title", "The result or error object (in JSON) from the last RPC response."); responsePara.Controls.Add(responseArea); Control statsPara = AddPara(content, null, null); statsPara.ID = "Stats"; Control headersPre = AddGeneric(content, "pre"); headersPre.ID = "Headers"; AddScriptInclude((Request.ApplicationPath.Equals("/") ? string.Empty : Request.ApplicationPath) + "/json.js"); AddScriptBlock(@" var callTemplates = " + BuildCallTemplatesObject() + @"; var theForm = null; var nextRequestId = 0; Number.prototype.formatWhole = function() { var s = this.toFixed(0).toString(); var groups = []; while (s.length > 0) { groups.unshift(s.slice(-3)); s = s.slice(0, -3); } return groups.join(); } window.onload = function() { theForm = document.forms[0]; Method_onchange(theForm.Method); } function Method_onchange(sender) { theForm.Request.value = callTemplates[sender.options[sender.selectedIndex].value]; } function Test_onclick(sender) { var stats = document.getElementById('Stats'); setText(stats, null); var headers = document.getElementById('Headers'); setText(headers, null); var form = theForm; try { var request = { id : ++nextRequestId, method : form.Method.value, params : JSON.parse(theForm.Request.value) }; form.Response.value = ''; form.Response.className = ''; var response = callSync(request); setText(stats, 'Time taken = ' + (response.timeTaken / 1000).toFixed(4) + ' milliseconds; Response size = ' + response.http.text.length.formatWhole() + ' char(s)'); setText(headers, response.http.headers); if (response.error != null) throw response.error; form.Response.value = JSON.stringify(response.result); } catch (e) { form.Response.className = 'error'; form.Response.value = JSON.stringify(e); alert(e.message); } } function callSync(request) { var http = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest(); http.open('POST', '" + Request.FilePath + @"', false); http.setRequestHeader('Content-Type', 'text/plain; charset=utf-8'); http.setRequestHeader('X-JSON-RPC', request.method); http.send(JSON.stringify(request)); if (http.status != 200) throw { message : http.status + ' ' + http.statusText, toString : function() { return this.message; } }; var clockStart = new Date(); var response = JSON.eval(http.responseText); response.timeTaken = (new Date()) - clockStart; response.http = { text : http.responseText, headers : http.getAllResponseHeaders() }; return response; } function setText(e, text) { while (e.firstChild) e.removeChild(e.firstChild); if (text == null) return; text = text.toString(); if (0 === text.length) return; var textNode = document.createTextNode(text); e.appendChild(textNode); } "); base.AddContent(); }
/// <summary> /// Request Object Form Value /// </summary> /// <param name="FormObject">WebControls, HtmlControls</param> /// <param name="sDefaultValue"></param> /// <returns>String</returns> public static string rf(object FormObject, string sDefaultValue = null) { string sRet = sDefaultValue; if (FormObject != null) { try { TextBox obj = (TextBox)FormObject; sRet = obj.Text; } catch { } finally { } try { System.Web.UI.HtmlControls.HtmlInputText obj = (System.Web.UI.HtmlControls.HtmlInputText)FormObject; sRet = obj.Value; } catch { } try { System.Web.UI.HtmlControls.HtmlInputHidden obj = (System.Web.UI.HtmlControls.HtmlInputHidden)FormObject; sRet = obj.Value; } catch { } try { System.Web.UI.HtmlControls.HtmlTextArea obj = (System.Web.UI.HtmlControls.HtmlTextArea)FormObject; sRet = obj.InnerText; } catch { } try { DropDownList obj = (DropDownList)FormObject; sRet = obj.SelectedItem.Value; } catch { } try { System.Web.UI.HtmlControls.HtmlSelect obj = (System.Web.UI.HtmlControls.HtmlSelect)FormObject; sRet = obj.Value; } catch { } try { RadioButtonList obj = (RadioButtonList)FormObject; sRet = obj.SelectedItem.Value; } catch { } try { System.Web.UI.HtmlControls.HtmlInputCheckBox obj = (System.Web.UI.HtmlControls.HtmlInputCheckBox)FormObject; sRet = obj.Value; } catch { } try { System.Web.UI.HtmlControls.HtmlInputRadioButton obj = (System.Web.UI.HtmlControls.HtmlInputRadioButton)FormObject; sRet = obj.Value; } catch { } } return(sRet); }