2009-07-30 51 views
0

我使用infragistics webcombotypeahead suggestInfragistics webcombo Typeahead建议

问题是我能够使用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;   
} 

回答

0

您可以通过简单的设置实现这一目标以下webcombo的性质:

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

,并绑定与数据源的网络组合在InitializeDataSource事件webcombo 的,也结合在page_load的webcombo当page.ispostback是真实的。

在存储过程中实现搜索逻辑,例如select * from employee where emp_name like 'a%'

这将在您记录数据时检索记录。