推荐一款自动建议功能的AJAX文本框

简介: AjaxLookup利用Ajax.Net的dll和WebUi的TextBox做成的一款,支持自动建议功能的AJAX文本框控件。使用方式极其简单,后台完成AJAX的建议提示的方法,前台添加进控件,稍作属性设置即可。
AjaxLookup

利用Ajax.Net的dll和WebUi的TextBox做成的一款,支持自动建议功能的AJAX文本框控件。

使用方式极其简单,后台完成AJAX的建议提示的方法,前台添加进控件,稍作属性设置即可。
同一页面可以放置多个此控件。

后台:
img_a6339ee3e57d1d52bc7d02b338e15a60.gif using  System;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  System.Collections;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  System.ComponentModel;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  System.Data;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  System.Text.RegularExpressions;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  System.Drawing;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  System.Web;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  System.Web.SessionState;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  System.Web.UI;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  System.Web.UI.WebControls;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  System.Web.UI.HtmlControls;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  Ajax;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  ThirdParty.Net;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
namespace  axLookupDemo
img_405b18b4b6584ae338e0f6ecaf736533.gifimg_1c53668bcee393edac0d7b3b3daff1ae.gif
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif {
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif    
/**//// <summary>
img_33d02437d135341f0800e3d415312ae8.gif    
/// Summary description for _Default.
img_105a1e124122b2abcee4ea8e9f5108f3.gif    
/// </summary>

img_33d02437d135341f0800e3d415312ae8.gif    public class axlDemo : System.Web.UI.Page
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif    
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif        
protected System.Web.UI.WebControls.Label Label1;
img_33d02437d135341f0800e3d415312ae8.gif        
protected AjaxLookup axLookup1;
img_33d02437d135341f0800e3d415312ae8.gif        
protected ThirdParty.Net.AjaxLookup axLookup2;
img_33d02437d135341f0800e3d415312ae8.gif        
protected System.Web.UI.WebControls.Label Label3;
img_33d02437d135341f0800e3d415312ae8.gif        
protected ThirdParty.Net.AjaxLookup axLookup3;
img_33d02437d135341f0800e3d415312ae8.gif        
protected System.Web.UI.WebControls.Label Label2;
img_33d02437d135341f0800e3d415312ae8.gif    
img_33d02437d135341f0800e3d415312ae8.gif        
private void Page_Load(object sender, System.EventArgs e)
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif        
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif            
//Ajax.Utility.RegisterTypeForAjax(GetType(ReferralsDB))
img_33d02437d135341f0800e3d415312ae8.gif
            Ajax.Utility.RegisterTypeForAjax(typeof(axlDemo));
img_105a1e124122b2abcee4ea8e9f5108f3.gif        }

img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif        [AjaxMethod()]
img_33d02437d135341f0800e3d415312ae8.gif        
public ArrayList GetSearchItems(string query)
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif        
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif            ArrayList matchItems 
= new ArrayList();
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif            
string[] item1 = img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{"C1""Item 1 - note that the box will grow to the size of the largest line"};
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif            
string[] item2 = img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{"C2""Item 2 - unless a DivWidth is specified"};
img_33d02437d135341f0800e3d415312ae8.gif            matchItems.Add(item1);
img_33d02437d135341f0800e3d415312ae8.gif            matchItems.Add(item2);
img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif            
return matchItems;
img_105a1e124122b2abcee4ea8e9f5108f3.gif        }

img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif        [AjaxMethod()]
img_33d02437d135341f0800e3d415312ae8.gif        
public ArrayList GetSearchItemsCN(string query)
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif        
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif            query 
=  System.Web.HttpUtility.UrlDecode(query);
img_33d02437d135341f0800e3d415312ae8.gif            
img_33d02437d135341f0800e3d415312ae8.gif            
//测试如果是数字,按数字匹配
img_33d02437d135341f0800e3d415312ae8.gif
            
img_33d02437d135341f0800e3d415312ae8.gif            
if ( IsValidInt( query ) )
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif            
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                ArrayList items 
= GetRecordsCNByDM();
img_33d02437d135341f0800e3d415312ae8.gif                ArrayList matchItems 
= new ArrayList();
img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif                
if ( query.Length > 0 )
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                
img_33d02437d135341f0800e3d415312ae8.gif                    
foreach (string[] item in items)
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                    
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                        
if (item[0].StartsWith(query))
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                        
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                            matchItems.Add(item);
img_105a1e124122b2abcee4ea8e9f5108f3.gif                        }

img_33d02437d135341f0800e3d415312ae8.gif
img_105a1e124122b2abcee4ea8e9f5108f3.gif                    }

img_105a1e124122b2abcee4ea8e9f5108f3.gif                }

img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif                
return matchItems;
img_105a1e124122b2abcee4ea8e9f5108f3.gif            }

img_33d02437d135341f0800e3d415312ae8.gif            
else //测试非数字按拼音缩写或汉字查找
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif
            img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                
if ( IsValidEnString( query) ) //拼音缩写
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif
                img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                    ArrayList items 
= GetRecordsCNByPY();
img_33d02437d135341f0800e3d415312ae8.gif                    ArrayList matchItems 
= new ArrayList();
img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif                    
if ( query.Length > 0 )
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                    
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                
img_33d02437d135341f0800e3d415312ae8.gif                        
foreach (string[] item in items)
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                        
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                            
if (item[0].ToUpper().StartsWith(query.ToUpper()))
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                            
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                                
string[] itemOut = new string[2];
img_33d02437d135341f0800e3d415312ae8.gif                                itemOut[
0= item[1];
img_33d02437d135341f0800e3d415312ae8.gif                                itemOut[
1= item[2];
img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif                                matchItems.Add(itemOut);
img_105a1e124122b2abcee4ea8e9f5108f3.gif                            }

img_33d02437d135341f0800e3d415312ae8.gif
img_105a1e124122b2abcee4ea8e9f5108f3.gif                        }

img_105a1e124122b2abcee4ea8e9f5108f3.gif                    }

img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif                    
return matchItems;
img_105a1e124122b2abcee4ea8e9f5108f3.gif                }

img_33d02437d135341f0800e3d415312ae8.gif                
else //全词查找
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif
                img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                    ArrayList items 
= GetRecordsCNByDM();
img_33d02437d135341f0800e3d415312ae8.gif                    ArrayList matchItems 
= new ArrayList();
img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif                    
if ( query.Length > 0 )
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                    
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                
img_33d02437d135341f0800e3d415312ae8.gif                        
foreach (string[] item in items)
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                        
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                            
if (item[1].StartsWith(query))
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                            
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                                matchItems.Add(item);
img_105a1e124122b2abcee4ea8e9f5108f3.gif                            }

img_33d02437d135341f0800e3d415312ae8.gif
img_105a1e124122b2abcee4ea8e9f5108f3.gif                        }

img_105a1e124122b2abcee4ea8e9f5108f3.gif                    }

img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif                    
return matchItems;
img_105a1e124122b2abcee4ea8e9f5108f3.gif                }

img_105a1e124122b2abcee4ea8e9f5108f3.gif            }
            
img_105a1e124122b2abcee4ea8e9f5108f3.gif        }

img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif        
private ArrayList GetRecordsCNByDM()
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif        
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif            ArrayList items 
= new ArrayList();
img_33d02437d135341f0800e3d415312ae8.gif
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif            
string[,] item = new string[,] img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                                                
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{"600616""G食品"},
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                                                
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{"600123""G瓜瓜"},
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                                                
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{"600601""G西西"},
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                                                
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{"600602""G西瓜"},
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                                                
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{"600102""G葡萄"},
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                                                
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{"600103""G枣子"},
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                                                
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{"600104""G哈密瓜"},
img_105a1e124122b2abcee4ea8e9f5108f3.gif            }
;
img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif            
for ( int i = 0; i < item.GetLength(0); i ++ )
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif            
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                
string[] itemLine = new string[item.GetLength(1)];
img_33d02437d135341f0800e3d415312ae8.gif                
img_33d02437d135341f0800e3d415312ae8.gif                
for ( int j = 0; j < itemLine.Length; j ++ )
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                    itemLine[j] 
= item[i,j].ToString();
img_105a1e124122b2abcee4ea8e9f5108f3.gif                }

img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif                items.Add( itemLine );
img_105a1e124122b2abcee4ea8e9f5108f3.gif            }

img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif            
return items;
img_105a1e124122b2abcee4ea8e9f5108f3.gif        }

img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif        
private ArrayList GetRecordsCNByPY()
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif        
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif            ArrayList items 
= new ArrayList();
img_33d02437d135341f0800e3d415312ae8.gif
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif            
string[,] item = new string[,] img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                                                
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{"GSP""600616""G食品"},
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                                                
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{"GGG""600123""G瓜瓜"},
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                                                
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{"GXX""600601""G西西"},
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                                                
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{"GXG""600602""G西瓜"},
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                                                
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{"GPT""600102""G葡萄"},
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                                                
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{"GZZ""600103""G枣子"},
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                                                
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{"GHM""600104""G哈密瓜"},
img_105a1e124122b2abcee4ea8e9f5108f3.gif            }
;
img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif            
for ( int i = 0; i < item.GetLength(0); i ++ )
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif            
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                
string[] itemLine = new string[item.GetLength(1)];
img_33d02437d135341f0800e3d415312ae8.gif                
img_33d02437d135341f0800e3d415312ae8.gif                
for ( int j = 0; j < itemLine.Length; j ++ )
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                    itemLine[j] 
= item[i,j].ToString();
img_105a1e124122b2abcee4ea8e9f5108f3.gif                }

img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif                items.Add( itemLine );
img_105a1e124122b2abcee4ea8e9f5108f3.gif            }

img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif            
return items;
img_105a1e124122b2abcee4ea8e9f5108f3.gif        }

img_33d02437d135341f0800e3d415312ae8.gif
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif        
/**////判断英文名 
img_33d02437d135341f0800e3d415312ae8.gif        private bool IsValidEnString( string EnString )
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif        
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif            
return Regex.IsMatch( EnString, @"^[a-zA-Z]{1,30}$" ); 
img_105a1e124122b2abcee4ea8e9f5108f3.gif        }

img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif        
//判断整型
img_33d02437d135341f0800e3d415312ae8.gif
        private bool IsValidInt( string IntString )
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif        
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif            
return Regex.IsMatch( IntString, @"^[0-9]{1,6}$" ); 
img_105a1e124122b2abcee4ea8e9f5108f3.gif        }

img_33d02437d135341f0800e3d415312ae8.gif
img_7a2b9a960ee9a98bfd25d306d55009f8.gifimg_2887d91d0594ef8793c1db92b8a1d545.gif        
Web Form Designer generated code#region Web Form Designer generated code
img_33d02437d135341f0800e3d415312ae8.gif        
override protected void OnInit(EventArgs e)
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif        
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif            
//
img_33d02437d135341f0800e3d415312ae8.gif            
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
img_33d02437d135341f0800e3d415312ae8.gif            
//
img_33d02437d135341f0800e3d415312ae8.gif
            InitializeComponent();
img_33d02437d135341f0800e3d415312ae8.gif            
base.OnInit(e);
img_105a1e124122b2abcee4ea8e9f5108f3.gif        }

img_33d02437d135341f0800e3d415312ae8.gif        
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif        
/**//// <summary>
img_33d02437d135341f0800e3d415312ae8.gif        
/// Required method for Designer support - do not modify
img_33d02437d135341f0800e3d415312ae8.gif        
/// the contents of this method with the code editor.
img_105a1e124122b2abcee4ea8e9f5108f3.gif        
/// </summary>

img_33d02437d135341f0800e3d415312ae8.gif        private void InitializeComponent()
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif        
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{    
img_33d02437d135341f0800e3d415312ae8.gif            
this.Load += new System.EventHandler(this.Page_Load);
img_33d02437d135341f0800e3d415312ae8.gif
img_105a1e124122b2abcee4ea8e9f5108f3.gif        }

img_105a1e124122b2abcee4ea8e9f5108f3.gif        
#endregion

img_105a1e124122b2abcee4ea8e9f5108f3.gif    }

img_05dd8d549cff04457a6366b0a7c9352a.gif}

img_a6339ee3e57d1d52bc7d02b338e15a60.gif

前台:就更简单了
img_405b18b4b6584ae338e0f6ecaf736533.gif img_1c53668bcee393edac0d7b3b3daff1ae.gif <% img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif @ Register TagPrefix="Ajax" Namespace="ThirdParty.Net" Assembly="AjaxLookup"  %>
img_405b18b4b6584ae338e0f6ecaf736533.gifimg_1c53668bcee393edac0d7b3b3daff1ae.gif
<% img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif @ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="axLookupDemo.axlDemo"  %>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"  >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
< HTML >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    
< HEAD >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
< title > Default </ title >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
< meta  content ="Microsoft Visual Studio .NET 7.1"  name ="GENERATOR" >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
< meta  content ="C#"  name ="CODE_LANGUAGE" >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
< meta  content ="JavaScript"  name ="vs_defaultClientScript" >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
< meta  content ="http://schemas.microsoft.com/intellisense/ie5"  name ="vs_targetSchema" >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
< script  language ="javascript"  src ="browser_detection.js" ></ script >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
< script  language ="javascript"  src ="axlookup.js" ></ script >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    
</ HEAD >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    
< body  MS_POSITIONING ="GridLayout" >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
< form  id ="Form1"  method ="post"  runat ="server" >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
< asp:label  id ="Label1"  style ="Z-INDEX: 100; LEFT: 48px; POSITION: absolute; TOP: 264px"  runat ="server"
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                Width
="80px"  Visible ="False" > Control #1 </ asp:label >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
< Ajax:AjaxLookup  id ="axLookup3"  style ="Z-INDEX: 106; LEFT: 40px; POSITION: absolute; TOP: 48px"  Width ="184px"
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                CallBackFunction
="axlDemo.GetSearchItemsCN"  HighlightColor ="#FFF791"  DivFont ="Arial"  DivPadding ="1px"
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                DivBorder
="1px solid gray"  BackgroundColor ="#EEE"  FontSize ="11px"  FontWeight ="bold"  ItemStyleBorderBottom ="0px"
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                ItemStylePadding
="1px 0px 1px 0px"  ItemStyleSpacing ="10px"  Runat ="server"  DivWidth ="184px" ></ Ajax:AjaxLookup >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
< asp:label  id ="Label3"  style ="Z-INDEX: 105; LEFT: 40px; POSITION: absolute; TOP: 24px"  runat ="server"
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                Width
="248px"  Font-Size ="X-Small" > 股票输入(代码、拼音缩写、全词) </ asp:label >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
< Ajax:AjaxLookup  id ="axLookup1"  style ="Z-INDEX: 102; LEFT: 48px; POSITION: absolute; TOP: 296px"
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                Width
="128px"  Runat ="server"  ItemStyleSpacing ="10px"  ItemStylePadding ="1px 0px 1px 0px"  ItemStyleBorderBottom ="0px"
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                FontWeight
="bold"  FontSize ="12px"  BackgroundColor ="#EEE"  DivBorder ="2px solid red"  DivPadding ="2px"
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                DivFont
="Arial"  HighlightColor ="#C30"  CallBackFunction ="axlDemo.GetSearchItems"  Visible ="False"   />
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
< asp:label  id ="Label2"  style ="Z-INDEX: 101; LEFT: 264px; POSITION: absolute; TOP: 264px"  runat ="server"
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                Width
="96px"  Visible ="False" > Control #2 </ asp:label >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
< Ajax:AjaxLookup  id ="axLookup2"  style ="Z-INDEX: 104; LEFT: 264px; POSITION: absolute; TOP: 296px"
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                Width
="128px"  CallBackFunction ="axlDemo.GetSearchItems"  HighlightColor ="gray"  DivFont ="Arial"
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                DivPadding
="2px"  DivBorder ="4px solid blue"  BackgroundColor ="#EEE"  FontSize ="12px"  FontWeight ="bold"
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                DivWidth
="200px"  ItemStyleBorderBottom ="0px"  ItemStylePadding ="1px 0px 1px 0px"  ItemStyleSpacing ="10px"
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                Runat
="Server"  Visible ="False"   />
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
</ form >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    
</ body >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
</ HTML >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif


附带示例:查询股票代码(分别可使用股票代码、名字拼音缩写名字来获取自动建议)
http://files.cnblogs.com/heekui/AjaxNET_Lookup_Control_2.rar
目录
相关文章
|
前端开发
mui中使用ajax实现登录功能demo
mui中使用ajax实现登录功能demo
155 3
|
前端开发
使用SpringMvc跨服务器上传图片,Ajax异步刷新图片框显示图片功能请求不到后台,onChange事件没有激活的源码?
使用SpringMvc跨服务器上传图片,Ajax异步刷新图片框显示图片功能请求不到后台,onChange事件没有激活的源码?
100 0
使用SpringMvc跨服务器上传图片,Ajax异步刷新图片框显示图片功能请求不到后台,onChange事件没有激活的源码?
|
JavaScript 搜索推荐 API
JQuery+ajax实现类似百度搜索自动匹配功能
JQuery+ajax实现类似百度搜索自动匹配功能
362 0
JQuery+ajax实现类似百度搜索自动匹配功能
|
前端开发 安全 JavaScript
使用Servlet+AJAX+AWT实现网站登录时的图片验证码功能
使用Servlet+AJAX+AWT实现网站登录时的图片验证码功能
197 0
使用Servlet+AJAX+AWT实现网站登录时的图片验证码功能
|
前端开发 JavaScript
基于SSM+Jquery+ajax实现批量删除功能
基于SSM+Jquery+ajax实现批量删除功能
462 0
基于SSM+Jquery+ajax实现批量删除功能
|
前端开发 PHP 数据格式
PHP与反ajax推送,实现的消息实时推送功能
index.html 反ajax推送 .send{color:#555;text-align: left;} .require{color:blue;text-align: right;} .
1169 0