.NET 自定义控件完成输入内容模糊检索功能,现在可以检索但不能自动提交 各位.NET高手们,我这里有一个问题,写了一个自定义控件,但是,不自动提交,谁能帮我修改一下啊,我是初学者,实在不知道问题的所在了,由于代码太长,就不往上贴了,如果有能够帮我的,加我QQ吧, 我给发过去,在这里非常感谢了,实在是愁了我一天啊。我QQ271690197 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.jzxue.com/wangzhankaifa/asp-net/201208/07-13475.html控件类必须实现IPostBackDataHandler接口,并实现LoadPostData和RaisePostDataChangedEvent方法。 可不可以呢,我是则接触.NET不久的,拜托… 大神哪谁来救救我哪,无奈原码附上,不自动提交,哪里有问题啊,自定义控件的代码using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;public partial class CustomerDropDown : System.Web.UI.UserControl, IPostBackDataHandler{ protected void Page_Load(object sender, EventArgs e) { //this.TextBox1.TextChanged+=new EventHandler(TextBox1_TextChanged); } /// <summary> /// 原始列表框的数据源 /// </summary> public Object DataSource { get { return this.ListBox1.DataSource; } set { this.ListBox1.DataSource = value; } } /// <summary> /// 原始数据的绑定成员 /// </summary> public String DataMember { get { return this.ListBox1.DataMember; } set { this.ListBox1.DataMember = value; } } /// <summary> /// 原始数据的绑定字段 /// </summary> public String DataTextField { get { return this.ListBox1.DataTextField; } set { this.ListBox1.DataTextField = value; } } /// <summary> /// 列表 /// </summary> public ListItemCollection Items { get { return this.ListBox1.Items; } } /// <summary> /// 选中项的索引 /// </summary> public int SelectedIndex { get { return this.ListBox1.SelectedIndex; } set { this.ListBox1.SelectedIndex = value; } } /// <summary> /// 选中值 /// </summary> public object SelectedValue { get { return this.ListBox1.SelectedValue; } } /// <summary> /// 输入框的值 /// </summary> public String Text { get { return this.TextBox1.Text; } set { this.TextBox1.Text = value; } } protected void TextBox1_TextChanged(object sender, EventArgs e) { //这个地方写自己的引用事件从程序 if (OnTextChangeCustomer != null) { OnTextChangeCustomer(sender, e); } } //public delegate void OnChangeCustomer(Object s,EventArgs e ); public event EventHandler OnTextChangeCustomer; public bool LoadPostData(string postDataKey, System.Collections.Specialized.NameValueCollection postCollection) { // throw new NotImplementedException(); string postedValue = postCollection[postDataKey]; string PresentValue = Text; if (PresentValue == null || postedValue != PresentValue) { Text = postedValue; return true; } return false; } //public bool AutoPostBack //{ // get // { // } //} public void RaisePostDataChangedEvent() { // throw new NotImplementedException(); OnTextChangeCustomer(null , EventArgs.Empty); }} 求助B/S的程序打包详细说明。 问个棘手问题 remoting中的重大发现。分少问题多,大侠多多帮忙 串口通讯专家进 上传文件,如果上传的文件与现有文件名重复应该怎么来处理? .net 2005 C# 实现ActiveX控件 AJAX问题 DataView 如何用ASP.net搭建通过支付宝付款的平台!立即结帐! 问一个Picshow控件能否在C#中使用,怎么使用,如果不能,有没有想类似的控件 如何用c#画图??? 关于利用C#编写窗口程序读取西门子PLC实时数据的问题。
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;public partial class CustomerDropDown : System.Web.UI.UserControl, IPostBackDataHandler
{
protected void Page_Load(object sender, EventArgs e)
{
//this.TextBox1.TextChanged+=new EventHandler(TextBox1_TextChanged);
} /// <summary>
/// 原始列表框的数据源
/// </summary>
public Object DataSource
{
get
{
return this.ListBox1.DataSource;
}
set
{
this.ListBox1.DataSource = value;
}
}
/// <summary>
/// 原始数据的绑定成员
/// </summary>
public String DataMember
{
get
{
return this.ListBox1.DataMember;
}
set
{
this.ListBox1.DataMember = value;
}
}
/// <summary>
/// 原始数据的绑定字段
/// </summary>
public String DataTextField
{
get
{
return this.ListBox1.DataTextField;
}
set
{
this.ListBox1.DataTextField = value;
}
} /// <summary>
/// 列表
/// </summary>
public ListItemCollection Items
{
get
{
return this.ListBox1.Items;
} }
/// <summary>
/// 选中项的索引
/// </summary>
public int SelectedIndex
{
get
{
return this.ListBox1.SelectedIndex;
}
set
{
this.ListBox1.SelectedIndex = value;
} }
/// <summary>
/// 选中值
/// </summary>
public object SelectedValue
{
get
{
return this.ListBox1.SelectedValue;
}
}
/// <summary>
/// 输入框的值
/// </summary>
public String Text
{
get
{
return this.TextBox1.Text;
}
set
{
this.TextBox1.Text = value;
}
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
//这个地方写自己的引用事件从程序
if (OnTextChangeCustomer != null)
{
OnTextChangeCustomer(sender, e);
}
} //public delegate void OnChangeCustomer(Object s,EventArgs e );
public event EventHandler OnTextChangeCustomer; public bool LoadPostData(string postDataKey, System.Collections.Specialized.NameValueCollection postCollection)
{
// throw new NotImplementedException();
string postedValue = postCollection[postDataKey];
string PresentValue = Text;
if (PresentValue == null || postedValue != PresentValue)
{
Text = postedValue;
return true;
}
return false;
}
//public bool AutoPostBack
//{
// get
// {
// }
//}
public void RaisePostDataChangedEvent()
{
// throw new NotImplementedException();
OnTextChangeCustomer(null , EventArgs.Empty);
}
}