using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; namespace SFAHPOI { [DefaultProperty("Text")] [ToolboxData("<{0}:NpaxDropDown runat="server"></{0}:NpaxDropDown>")] public class NpaxDropDown : DropDownList, IPostBackDataHandler { [Bindable(true)] [Category("Appearance")] [DefaultValue("")] [Localizable(true)] public string Text { get { String s = this.Text; return ((s == null) ? String.Empty : s); } set { this.Text = value; EnsureChildControls(); } } [Bindable(true)] [Category("DataBind")] [DefaultValue("")] [Localizable(true)] public DataTable DataSource { get { DataTable s = (DataTable)ViewState["DataSource"]; return ((s == null) ? new DataTable(): s); } set { ViewState["DataSource"] = value; EnsureChildControls(); } } [Bindable(true)] [Category("DataBind")] [DefaultValue("")] [Localizable(true)] public string DataValueField { get { String s = (string)ViewState["DataValueField"]; if (s == null) { return String.Empty; } else { return s; } } set { ViewState["DataValueField"]=value; EnsureChildControls(); } } [Bindable(true)] [Category("DataBind")] [DefaultValue("")] [Localizable(true)] public string DataTextField { get { String s = (string)ViewState["DataTextField"]; return ((s == null) ? String.Empty : s); } set { ViewState["DataValueField"] = value; EnsureChildControls(); } } protected override void CreateChildControls() { this.DataTextField = DataTextField; this.DataValueField = DataValueField; this.DataSource = DataSource; base.CreateChildControls(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using SFAHPOI; using System.Data; using HpoiBL; using DevExpress.XtraCharts.Web; namespace HPOI_SFA { public partial class WebForm4 : System.Web.UI.Page { string[] usernames= new string[5]; int s; ScreenMasterBL SM; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { NpaxDropDown1.DataSource = SM.GetScreens(); NpaxDropDown1.DataValueField = "ScreenID"; NpaxDropDown1.DataTextField = "ScreenName"; NpaxDropDown1.DataBind(); } else { } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)