日期:2014-05-19  浏览次数:20440 次

菜鸟来了,高手请进,50分求助!
using   System;
using   System.Data;
using   System.Web.UI;
using   System.Web.UI.WebControls;
using   System.ComponentModel;

namespace   Tripal.Web.UI.Controls
{
///   <summary>
///   WebCustomControl1   的摘要说明。
///   </summary>
[DefaultProperty( "Text "),  
ToolboxData( " <{0}:TripalCheckList   runat=server> </{0}:TripalCheckList> ")]
public   class   TripalCheckList   :   System.Web.UI.WebControls.WebControl
{
private   TextBox   txtListContent;
private   TextBox   txtListID;
private   DataTable   _DataSource   =   null;
private   string   _DataValueField;
private   string   _DataTextField;
private   string   _DropDownHeight=string.Empty;

public   TripalCheckList()
{

}

 
public   override   Unit   Width
{
get
{
return   txtListContent.Width;
}
set
{
txtListContent.Width   =   value;
base.Width   =   value;
}
}

public   string   DropDownHeight
{
get
{
return   _DropDownHeight;
}
set
{
_DropDownHeight   =   value;
}
}

///   <summary>
///   设置控件数据源
///   </summary>
public   DataTable   DataSource  
{
set
{
_DataSource   =   value;
}
}

///   <summary>
///   设置数据绑定的值
///   </summary>
public   string   DataValueField
{
set
{
_DataValueField   =   value;
}
}

///   <summary>
///   设置列表数据显示文本
///   </summary>
public   string   DataTextField
{
set
{
_DataTextField   =   value;
}
}

string   _SelectedListText   =   string.Empty;
public   string   SelectedListText
{
set
{
_SelectedListText   =   value;
}
get
{
return   _SelectedListText;
}
}

string   _SelectedListValue   =   string.Empty;
public   string   SelectedListValue
{
set
{
_SelectedListValue   =   value;
}
get
{
return   _SelectedListValue;
}
}

protected   override   void   LoadViewState(object   savedState)
{
base.LoadViewState   (savedState);
this.SelectedListText   =   ViewState[ "CUR_TEXT "].ToString();
this.SelectedListValue   =   ViewState[ "CUR_VALUE "].ToString();
}

protected   override   object   SaveViewState()
{
ViewState[ "CUR_TEXT "]   =   this.txtListContent.Text.Trim();
ViewState[ "CUR_VALUE "]   =   this.txtListID.Text;
return   base.SaveViewState   ();
}

protected   override   void   CreateChildControls()
{
txtListContent