private void AddSalesTypeField(HtmlGenericControl container) { using (HtmlGenericControl salesTypeDiv = HtmlControlHelper.GetField()) { salesTypeDiv.ID = "SalesTypeDiv"; salesTypeDiv.Attributes.Add("style", "width:200px"); using (HtmlGenericControl field = HtmlControlHelper.GetField()) { using (HtmlGenericControl label = HtmlControlHelper.GetLabel(Titles.SalesType, "SalesTypeSelect")) { field.Controls.Add(label); } using (HtmlSelect salesTypeSelect = new HtmlSelect()) { salesTypeSelect.ID = "SalesTypeSelect"; salesTypeSelect.DataSource = this.GetSalesTypes(); salesTypeSelect.DataTextField = "Text"; salesTypeSelect.DataValueField = "Value"; salesTypeSelect.DataBind(); field.Controls.Add(salesTypeSelect); } salesTypeDiv.Controls.Add(field); } container.Controls.Add(salesTypeDiv); } }
private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 if (!Page.IsPostBack) { //操作者登录名 HttpCookie UserCookie = Request.Cookies["Username"]; Username = UserCookie.Value.ToString(); PositionID = (Request.QueryString["PositionID"] == null)?"":Request.QueryString["PositionID"].ToString(); displayType = (Request.QueryString["displayType"] == null)?"":Request.QueryString["displayType"].ToString(); selectedID = (Request.QueryString["StaffIDS"] == null)?"":Request.QueryString["StaffIDS"].ToString(); backfilepath = (Request.QueryString["BackFilePath"] == null)?"":Request.QueryString["BackFilePath"].ToString(); SqlDataReader dr; UDS.Components.Database db = new UDS.Components.Database(); db.RunProc("SP_Ext_GetPosition", out dr); cboPosition.DataSource = dr; cboPosition.DataTextField = "Position_Name"; cboPosition.DataValueField = "Position_ID"; cboPosition.DataBind(); } if (Request.QueryString["ReturnPage"] != null) { ReturnPage = Int32.Parse(Request.QueryString["ReturnPage"].ToString()); } else { ReturnPage = 0; } }
public static HtmlSelect Combo_Comuna_despacho(System.Web.UI.HtmlControls.HtmlSelect combo, string cod_ciu) { combo.ID = "cmbComunasaseg"; combo.Name = "cmbComunasaseg"; if (cod_ciu != "0") { Localidades comu = new Localidades(); combo.DataSource = comu.Carga_Comunas_despacho(cod_ciu); combo.DataTextField = "nom_localidad"; combo.DataValueField = "cod_localidad"; combo.DataBind(); if (combo.Items.Count > 1) { combo = UtilesWeb.Agrega_Seleccionar(combo); } } else { combo = UtilesWeb.Agrega_Seleccionar(combo); } return(combo); }
//允许显示的菜单栏目 private void CreateRightAccount(HtmlSelect listcontrolright, int TopMenuId) { Johnny.CMS.BLL.SystemInfo.TopMenuBinding bll = new Johnny.CMS.BLL.SystemInfo.TopMenuBinding(); listcontrolright.DataSource = bll.GetList(TopMenuId); listcontrolright.DataTextField = "MenuCategoryName"; listcontrolright.DataValueField = "MenuCategoryId"; listcontrolright.DataBind(); }
private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { cboTest.DataSource = new string[] { "item1", "item2", "item3", "item4" }; cboTest.DataBind(); } }
//拥有权限 private void CreateRightAccount(HtmlSelect listcontrolright, int TopMenuId) { Johnny.CMS.BLL.Access.RolePermission bll = new Johnny.CMS.BLL.Access.RolePermission(); listcontrolright.DataSource = bll.GetList(RoleId, PermissionCategoryId); listcontrolright.DataTextField = "PermissionName"; listcontrolright.DataValueField = "PermissionId"; listcontrolright.DataBind(); }
protected void BindDdlPwdQuestion(System.Web.UI.HtmlControls.HtmlSelect ddl_PwdQuestion) { BLL.Sys_SecurityQuestion BLL = new BLL.Sys_SecurityQuestion(); string whereStr = " IsDeleted=0 and Status=1"; IList <Model.Sys_SecurityQuestion> list = BLL.GetList(whereStr); ddl_PwdQuestion.DataSource = list; ddl_PwdQuestion.DataTextField = "Question"; ddl_PwdQuestion.DataValueField = "ID"; ddl_PwdQuestion.DataBind(); }
public static void bindSelect(System.Web.UI.HtmlControls.HtmlSelect select, DataTable dt, string value, string text, string add) { select.DataSource = dt; select.DataValueField = value; select.DataTextField = text; select.DataBind(); if (add != "") { select.Items.Insert(0, new ListItem(add, "--")); } }
private void LoadHuyen(string idTinh, System.Web.UI.HtmlControls.HtmlSelect sl, string idHuyen) { string strSql = "select * from tb_Huyen where idTinh='" + idTinh + "'"; sl.DataSource = Connect.GetTable(strSql); sl.DataTextField = "TenHuyen"; sl.DataValueField = "idHuyen"; sl.DataBind(); sl.Items.Add(new ListItem("Chọn Quận/Huyện", "0")); sl.Items.FindByValue(idHuyen).Selected = true; }
// Put user code to initialize the page here public void getDataSet(int datasetId) { DataSet ptDataSet = new DataSet(); ptDataSet.ReadXml(MapPath("datasets.xml")); sel.DataSource = ptDataSet; Response.Write(ptDataSet.Tables[0].Columns[0] + "\n"); //dataset_Id Response.Write(ptDataSet.Tables[0].Columns[1] + "\n"); //id Response.Write(ptDataSet.Tables[0].Columns[2] + "\n"); //name //sel.DataValueField="value"; //sel.DataTextField="type"; sel.DataBind(); }
private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here if (!IsPostBack) { string [][] vals = new string[] [] { new string [] { "1", "2", "3" }, new string [] { "a", "b", "c" } }; Dropdownlist2.DataSource = ListBox1.DataSource = DropDownList1.DataSource = new string [] { "a", "b", "c" }; //DropDownList1.Items.Add(new ListItem("","")); DropDownList1.DataBind(); ListBox1.DataBind(); Dropdownlist2.DataBind(); } Response.Write(Dropdownlist2.DataSource); }
private void Bind() { UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow(); if (DocID > 0) { //读取稿件内容 FlowID = df.GetDocumentFlowID(DocID); StepID = df.GetDocumentStepID(DocID); ProjectID = 0; cmdSend.Enabled = true; cmdDelete.Enabled = true; bEditMode = true; if (df.IsProject(UserName, DocID)) { ProjectID = Int32.Parse(PID.Value); if (!Page.IsPostBack) { DataTable dt; ddlProject.Visible = true; ddlProject.Items.Clear(); df.GetProject(UserName, out dt); ddlProject.DataSource = dt.DefaultView; ddlProject.DataTextField = "ClassName"; ddlProject.DataValueField = "ClassID"; ddlProject.DataBind(); // for(int i=0;i<ddlProject.Items.Count;i++) // { // if(ddlProject.Items[i].Value.ToString()==UDS.Components.DocumentFlow.GetDocumentProjectID(DocID).ToString()) // ddlProject.SelectedIndex = i; // } if (ddlProject.Items.Count > 0) { PID.Value = ddlProject.Items[0].Value.ToString(); } } } else { // StepID = 1; // cmdSend.Enabled = false; // cmdDelete.Enabled = false; // bEditMode = false; ddlProject.Visible = false; ddlProject.EnableViewState = false; } } else { StepID = 1; cmdSend.Enabled = false; cmdDelete.Enabled = false; bEditMode = false; ddlProject.EnableViewState = false; ddlProject.Visible = false; } df = null; }
protected override void AttachChildControls() { radlAddress = (Common_ShippingAddressRadioButtonList)FindControl("Common_ShippingAddressesRadioButtonList"); dropRegions = (RegionSelector)FindControl("dropRegions"); txtShipTo = (TextBox)FindControl("txtShipTo"); txtAddress = (TextBox)FindControl("txtAddress"); txtZipcode = (TextBox)FindControl("txtZipcode"); txtCellPhone = (TextBox)FindControl("txtCellPhone"); txtTelPhone = (TextBox)FindControl("txtTelPhone"); orderOptionList = (Common_OrderOptionList)FindControl("Common_OrderOptions"); shippingModeList = (Common_ShippingModeList)FindControl("Common_ShippingModeList"); paymentModeList = (Common_PaymentModeList)FindControl("grd_Common_PaymentModeList"); inputPaymentModeId = (HtmlInputHidden)FindControl("inputPaymentModeId"); inputShippingModeId = (HtmlInputHidden)FindControl("inputShippingModeId"); hdbuytype = (HtmlInputHidden)FindControl("hdbuytype"); lblPaymentPrice = (PaymentPriceLabel)FindControl("lblPaymentPrice"); lblShippModePrice = (ShippingModePriceLabel)FindControl("lblShippModePrice"); cartProductList = (Common_SubmmintOrder_ProductList)FindControl("Common_SubmmintOrder_ProductList"); cartGiftList = (Common_SubmmintOrder_GiftList)FindControl("Common_SubmmintOrder_GiftList"); lblOrderOptionPrice = (OrderOptionPriceLabel)FindControl("lblOrderOptionPrice"); litProductAmount = (Literal)FindControl("litProductAmount"); litAllWeight = (WeightLabel)FindControl("litAllWeight"); litPoint = (PointTotalLabel)FindControl("litPoint"); lblOrderTotal = (OrderTotalPriceLabel)FindControl("lblOrderTotal"); lblCartTotalPrice = (CartTotalPriceLabel)FindControl("lblCartTotalPrice"); txtMessage = (TextBox)FindControl("txtMessage"); hlkFeeFreeName = (HyperLink)FindControl("hlkFeeFreeName"); lblServiceChargeFree = (ServiceChargeFreeNameLabel)FindControl("lblServiceChargeFree"); lblShipChargeFee = (ShipChargeFeeNameLabel)FindControl("lblShipChargeFee"); lblPackingChargeFree = (PackingChargeFreeNameLabel)FindControl("lblPackingChargeFree"); hlkDiscountName = (HyperLink)FindControl("hlkDiscountName"); litDiscountPrice = (Literal)FindControl("litDiscountPrice"); htmlCouponCode = (HtmlInputText)FindControl("htmlCouponCode"); CmbCoupCode = (HtmlSelect)FindControl("CmbCoupCode"); litCouponAmout = (CouponPriceLabel)FindControl("litCouponAmout"); btnCreateOrder = ButtonManager.Create(FindControl("btnCreateOrder")); btnCreateOrder.Click += new EventHandler(btnCreateOrder_Click); if (!Page.IsPostBack) { //绑定地址 BindUserAddress(); //绑定订单 orderOptionList.DataSource = ShoppingProcessor.GetUsableOrderLookupLists(); orderOptionList.DataBind(); //绑定配送方式 shippingModeList.DataSource = ShoppingProcessor.GetShippingModes(); shippingModeList.DataBind(); //绑定支付方式 ReBindPayment(); if (shoppingCart != null) { BindPromote(shoppingCart); BindShoppingCartInfo(shoppingCart); CmbCoupCode.DataTextField = "DisplayText"; CmbCoupCode.DataValueField = "ClaimCode"; CmbCoupCode.DataSource = ShoppingProcessor.GetCoupon(shoppingCart.GetTotal()); CmbCoupCode.DataBind(); ListItem item = new ListItem("", "0"); CmbCoupCode.Items.Insert(0, item); hdbuytype.Value = buytype; } } }
private void Bind() { UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow(); Database mySQL = new Database(); long FlowID; long StepID; DataTable dt; FlowID = df.GetDocumentFlowID(DocID); StepID = df.GetDocumentStepID(DocID); cmdPostilFinish.Visible = cmdPostilFinish.Visible && df.GetStepRightToFinish(FlowID, StepID) == 1?true:false; ProjectID = Int32.Parse(PID.Value); //流程批阅状态并且按照项目流转 if (FlowState == true && df.IsProject(UserName, DocID)) { if (!Page.IsPostBack) { ddlProject.Visible = true; ddlProject.Items.Clear(); df.GetProject(UserName, out dt); ddlProject.DataSource = dt.DefaultView; ddlProject.DataTextField = "ClassName"; ddlProject.DataValueField = "ClassID"; ddlProject.DataBind(); if (ddlProject.Items.Count > 0) { PID.Value = ddlProject.Items[0].Value; } else { PID.Value = "-1"; } } } else { ddlProject.Visible = false; } df.GetDocumentInfo(DocID, out dt); AddRow(tabDispDocument, "基本信息"); AddRow(tabDispDocument, "流程:", dt.Rows[0]["flow_name"].ToString()); AddRow(tabDispDocument, "发送者:", dt.Rows[0]["realname"].ToString()); AddRow(tabDispDocument, "发送日期:", dt.Rows[0]["doc_added_date"].ToString()); AddRow(tabDispDocument, "当前步骤:", "<a href='DisplayTacheMember.aspx?DocID=" + DocID.ToString() + "&ReturnPage=" + ReturnPage.ToString() + "'>" + dt.Rows[0]["Step_name"].ToString() + "</a>"); AddRow(tabDispDocument, "详细表单"); if (dt.Rows.Count > 0) { FlowID = Int32.Parse(dt.Rows[0]["flow_id"].ToString()); HtmlForm PostilDocument = (HtmlForm)this.Page.FindControl("PostilDocument"); //=============================// // 添加正文 //=============================// DataTable dtSheet; df.GetStyleDescription(FlowID, 0, out dtSheet); for (int i = 0; i < dtSheet.Rows.Count; i++) { AddRow(tabDispDocument, dtSheet.Rows[i]["Field_Description"].ToString() + ":", dt.Rows[0][dtSheet.Rows[i]["Field_Name"].ToString()].ToString()); } dtSheet = null; //=============================// // 添加附件 //=============================// AddAttach(DocID); //=============================// // 添加批注 //=============================// DataTable dtPostil; df.GetDocumentPostil(DocID, out dtPostil); if (dtPostil.Rows.Count > 0) { AddRow(tabDispDocument, "审批意见"); AddPostitleHead(tabDispDocument); for (int i = 0; i < dtPostil.Rows.Count; i++) { AddRow(tabDispDocument, dtPostil.Rows[i]["RealName"].ToString(), dtPostil.Rows[i]["Postil_Date"].ToString(), dtPostil.Rows[i]["Postil_Content"].ToString(), Int32.Parse(dtPostil.Rows[i]["Postil_Type"].ToString()), dtPostil.Rows[i]["FileName"].ToString(), dtPostil.Rows[i]["FileVisualPath"].ToString(), dtPostil.Rows[i]["usedtime"].ToString()); } } dtPostil = null; AddProjectControl(); AddControl(tabDispDocument); } }
/// <summary> /// 无分页数据绑定(列表控件) /// </summary> /// <param name="ctrl"></param> /// <param name="source"></param> public static void BindControl(HtmlSelect ctrl, object source) { ctrl.DataSource = source; ctrl.DataBind(); }