Infragistics webcombo Typeahead 建议
我正在使用 infragistics webcombo
和 typeahead suggest
。
问题是我可以使用 xmlReq
访问 WebCombo1_InitializeDataSource
,但数据在 webcombo
中不可见。
下面是我正在使用的代码片段:
<igcmbo:WebCombo ID="WebCombo1" runat="server" EnableXmlHTTP="True" Editable="True"
ComboTypeAhead="Suggest">
<Columns>
<ClientSideEvents EditKeyUp="WebCombo1_EditKeyUp">
</ClientSideEvents>
</igcmbo:WebCombo>
Javascript函数:
function WebCombo1_EditKeyUp(webComboId,newValue,keyCode)
{
var oWebCombo1=igcmbo_getComboById(webComboId)
xmlReq = null;
if(window.XMLHttpRequest) xmlReq = new XMLHttpRequest();
else if(window.ActiveXObject) xmlReq = new ActiveXObject("Microsoft.XMLHTTP");
var search=newValue&&newValue.length&&newValue.length>0?newValue:"";
xmlReq.open("GET","ActivityManagement.aspx?searchString="+search,true);
xmlReq.send(null);
}
代码隐藏:
void WebCombo1_InitializeDataSource(object sender, Infragistics.WebUI.WebCombo.WebComboEventArgs e)
{
string str = "";
if (this.Request.QueryString["searchString"] != null)
{
str = this.Request.QueryString["searchString"].ToUpper();
}
else str = "00";
DataTable dtProducts = OperationsDataAccess.GetProductList(str);
string rowFilter = "DeleteFlag = 0";
dtProducts.DefaultView.RowFilter = rowFilter;
WebCombo1.DataSource = dtProducts.DefaultView;
WebCombo1.DataTextField = "Name";
WebCombo1.DataValueField = "Id";
WebCombo1.DataBind();
WebCombo1.DropDownLayout.RowSelectors = RowSelectors.No;
}
I am using infragistics webcombo
with the typeahead suggest
.
The problem is that I am able to reach the WebCombo1_InitializeDataSource
using the xmlReq
, but the data is not visible in the webcombo
.
Below is the piece of code I am using:
<igcmbo:WebCombo ID="WebCombo1" runat="server" EnableXmlHTTP="True" Editable="True"
ComboTypeAhead="Suggest">
<Columns>
<ClientSideEvents EditKeyUp="WebCombo1_EditKeyUp">
</ClientSideEvents>
</igcmbo:WebCombo>
Javascript function :
function WebCombo1_EditKeyUp(webComboId,newValue,keyCode)
{
var oWebCombo1=igcmbo_getComboById(webComboId)
xmlReq = null;
if(window.XMLHttpRequest) xmlReq = new XMLHttpRequest();
else if(window.ActiveXObject) xmlReq = new ActiveXObject("Microsoft.XMLHTTP");
var search=newValue&&newValue.length&&newValue.length>0?newValue:"";
xmlReq.open("GET","ActivityManagement.aspx?searchString="+search,true);
xmlReq.send(null);
}
Code behind :
void WebCombo1_InitializeDataSource(object sender, Infragistics.WebUI.WebCombo.WebComboEventArgs e)
{
string str = "";
if (this.Request.QueryString["searchString"] != null)
{
str = this.Request.QueryString["searchString"].ToUpper();
}
else str = "00";
DataTable dtProducts = OperationsDataAccess.GetProductList(str);
string rowFilter = "DeleteFlag = 0";
dtProducts.DefaultView.RowFilter = rowFilter;
WebCombo1.DataSource = dtProducts.DefaultView;
WebCombo1.DataTextField = "Name";
WebCombo1.DataValueField = "Id";
WebCombo1.DataBind();
WebCombo1.DropDownLayout.RowSelectors = RowSelectors.No;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您只需设置
webcombo
的以下属性即可实现此目的:并在 webcombo 的
InitializeDataSource
事件中将 Web 组合与数据源绑定当
page.ispostback
为 true 时,还在page_load
中绑定 webcombo。在存储过程中实现搜索逻辑,例如
select * from employee where emp_name like 'a%'
。当您输入数据时,这将检索记录。
You can achieve this by simply setting the following properties of the
webcombo
:And bind the web combo with the datasource in the
InitializeDataSource
event of the webcomboand also bind the webcombo in the
page_load
when thepage.ispostback
is true .Implement the search logic in your stored procedure, e.g.
select * from employee where emp_name like 'a%'
.This will retrieve the records as and when you keey in the data.