Infragistics webcombo Typeahead 建议

发布于 2024-07-30 06:13:48 字数 1998 浏览 11 评论 0原文

我正在使用 infragistics webcombotypeahead 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁吢 2024-08-06 06:13:48

您只需设置 webcombo 的以下属性即可实现此目的:

EnableXmlHTTP="True" 
Editable="True"
ComboTypeAhead="Suggest"

并在 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:

EnableXmlHTTP="True" 
Editable="True"
ComboTypeAhead="Suggest"

And bind the web combo with the datasource in the InitializeDataSource event of the webcombo
and also bind the webcombo in the page_load when the page.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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文