下拉文件框的自定義控件

来源:互联网 发布:任以为己任 不亦重乎 编辑:程序博客网 时间:2024/05/13 14:24
Ascx File:<%@ Control Language="c#" AutoEventWireup="false" Codebehind="TextDrop.ascx.cs" Inherits="CNetComPonents.UserControls.UCPowerTextBox" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
Ascx.Cs:namespace CNetComPonents.UserControls{ using System; using System.Data; using System.Drawing; using System.Web; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; /// /// WebUserControl1 腔晡猁佽隴﹝ /// public class UCPowerTextBox : System.Web.UI.UserControl { protected System.Web.UI.WebControls.TextBox UCTextBox; protected System.Web.UI.WebControls.ListBox UCListBox; private void Page_Load(object sender, System.EventArgs e) { // 婓森揭溫离蚚誧測鎢眕場宎趙珜醱 UCListBox.Style.Add("visibility","hidden"); } #region Web 敦极扢數汜傖腔測鎢 override protected void OnInit(EventArgs e) { // // CODEGEN: 蜆覃蚚岆 ASP.NET Web 敦极扢數垀斛剒腔﹝ // InitializeComponent(); base.OnInit(e); } /// /// 扢數盓厥垀剒腔源楊 - 祥猁妏蚚測鎢晤憮 /// 党蜊森源楊腔囀﹝ /// private void InitializeComponent() { this.Page.Load +=new EventHandler(Page_Load); this.UCListBox.Attributes["onclick"]="javascript:UCListBox_click();"; } #endregion public string Text { get { return UCTextBox.Text; } set { UCTextBox.Text = value; } } public int Width { set { UCTextBox.Width = value; UCListBox.Width = value; } } public object DataSource { set { UCListBox.DataSource = value; } } public string DataTextField { set { UCListBox.DataTextField = value; } } public string DataValueField { set { UCListBox.DataValueField = value; } } public new void DataBind() { UCListBox.DataBind(); } public int Rows { set { UCListBox.Rows = value; } } }}