ASP.NET - Creating Auto suggest textbox control dynamically

Asked By new vel
09-Sep-10 01:05 AM
Hi all,
I my application, user will enter the field names in admin panel link
1) Vender name(textbox, autosuggest)
2) Item Name(Textbox, autosuggest)
3) Vendor Address(Textarea)

Like this.
So i have to create a input controls for this fields. I have created textbox for all fields dynamically.
Now my problem is how to implement the auto suggest option for those textboxes.
I am creating textbox array to load controls and store the value. So that, i can get the values back when ever the postback occure.

please see the image below.


So can any one tell me how to implement the auto suggest textbox dynamically ?

Thanks in Advance
Vel
 
  Super Man replied to new vel
09-Sep-10 01:15 AM

you can do auto suggest implementation using Ajax.

you might seen in google search textbox.

You can refer this articles:

http://www.codeproject.com/KB/ajax/AJAXAutoSuggest.aspx

http://www.highoncoding.com/Articles/171_ATLAS%20AUTO-SUGGEST%20TEXTBOX.aspx

http://www.chrismanciero.com/autosuggest.aspx

http://www.progtalk.com/ViewArticle.aspx?ArticleID=40

  Sreekumar P replied to new vel
09-Sep-10 01:24 AM
hai........


here u have the best and reliable Autosuggest .

http://

and

http://

thank u.........
  [ Kirtan ] replied to new vel
09-Sep-10 01:59 AM
Here is How you can do it ..

1 . Add Reference to AjaxControl Tool Kit ..
2. Add Script Manager from tool box to your page
3. Add uusing statement like below

using AjaxControlToolkit;

and Finally you can add Both TextBox and AutocompleteExtender Dynamically 

  protected void Button2_Click(object sender, EventArgs e)
  {
    
     /* creating TextBox Dynamically */
    TextBox t = new TextBox();
    t.ID = "txtDynamicText";
    Page.Form.Controls.Add(t);

    /* Creating Autocomplete Extender Dynamicaly */
    AutoCompleteExtender autocomp = new AutoCompleteExtender();
    autocomp.ID = "AutoCompleteExtender1";
    autocomp.TargetControlID = "txtDynamicText";
    autocomp.ServiceMethod = "GetCompletionList";
    autocomp.CompletionInterval = 100;
    autocomp.MinimumPrefixLength = 1;
    Page.Form.Controls.Add(autocomp);


  }

  
    [System.Web.Services.WebMethod]
     public static string[] GetCompletionList(string prefixText, int count)
     {
    List<string> list = new List<string>();
    list.Add("ABC");
    list.Add("Test");
    list.Add("kirtan");
    return list.ToArray();

     }   

Create New Account
help
of Ajax AutoComplete Extender <asp:ScriptManager ID = "ScriptManager1" runat = "server" EnablePageMethods = "true"> < / asp:ScriptManager> <asp:TextBox ID = "txtContactsSearch" runat = "server"> < / asp:TextBox> <cc1:AutoCompleteExtender ServiceMethod = "SearchCustomers" MinimumPrefixLength = "2" CompletionInterval = "100" EnableCaching = "false" CompletionSetCount = "10" TargetControlID = "txtContactsSearch" ID AutoCompleteExtender1" runat = "server" ServiceMethod = "GetCountryOrStatesInfo" ServicePath = "HoliCity.asmx" MinimumPrefixLength = "1" TargetControlID = "txtLocation" > < / cc1:AutoCompleteExtender> <asp:TextBox ID = "txtLocation" runat = "server"> < / asp:TextBox> and my webservice's code is: [WebMethod] public string[] GetCountryOrStatesInfo(string prefixText) { int count = 10 c: \ windows" ) ; return dir .GetFiles () .Where ( f = > f.Name.StartsWith ( prefixText ) ) .Select ( f = > f.Name ) .ToArray () ; } } File: AutoCompleteWebService.aspx <%@ Page Language = "C#" %> <%@ Register TagPrefix = "ajax" Namespace = "AjaxControlToolkit" Assembly = "AjaxControlToolkit" %> <!DOCTYPE html PUBLIC "- / / W3C / / DTD XHTML org / TR / xhtml1 / DTD / xhtml1-transitional.dtd" > <script runat = "server" > protected void btnSubmit_Click ( object sender, EventArgs e ) { lblSelectedFileName.Text = txtFileName.Text; } < / script> < html xmlns = "http: / / www.w3.org / 1999 / xhtml" > <head sm1" runat = "server" / > <asp:Label id = "lblFileName" Text = "File Name:" AssociatedControlID = "txtFileName" Runat = "server" / > <asp:TextBox id = "txtFileName" AutoComplete = "off" Runat = "server" / > <ajax:AutoCompleteExtender id = "ace1" TargetControlID = "txtFileName" ServiceMethod = "GetSuggestions" ServicePath
other record numric str I have a problem of who to update the image in ASP.NET gridview please chick my code and tell me what is the problem in it and me who to solve this problem My .CS Code is protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) DisplayStudentInformation(); } private void DisplayStudentInformation() { SqlDataReader reader = DAC.GetCompanyInformation(); reader.Read(); StudentGridView.DataSource = reader; StudentGridView.DataBind(); reader.Close(); } protected void UploadButton_Click(object sender, EventArgs e) { string studentID1 = StudentIDTextBox.Text.ToString(); string studentFirstName = StudentFirstNameTextBox.Text.ToString(); string studentLastName = StudentLastNameTextBox.Text public byte[] ConvertImageToByteArray(FileUpload fuImage) { byte[] ImageByteArray; MemoryStream ms = new MemoryStream(fuImage.FileBytes); ImageByteArray = ms.ToArray(); return ImageByteArray; } protected void studentGridview_RowEditing(object sender, GridViewEditEventArgs e) { StudentGridView.EditIndex = e.NewEditIndex; DisplayStudentInformation(); } protected in the StudentID table for Updating how to fix it please tell me ? string StudentID = ((TextBox)StudentGridView.Rows[e.RowIndex].Cells[0].FindControl("txtStudentID")).Text; string FirstName = ((TextBox)StudentGridView.Rows[e.RowIndex].Cells[1].FindControl("txtStudentFName")).Text; string LastName = ((TextBox)StudentGridView.Rows[e.RowIndex].Cells[2].FindControl("txtStudentLName")).Text; string Gender = ((TextBox)StudentGridView.Rows[e
using System.Data.SqlClient; using System.Configuration.Assemblies; public partial class Default2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } [System.Web.Script.Services.ScriptMethod()] [System.Web.Services.WebMethod] public static List<string> SearchEmployee Read()) { employees.Add(sdr["empname"].ToString()); } } conn.Close(); return employees; } } } protected void searchtext_TextChanged(object sender, EventArgs e) { SearchEmployee(searchtext.Text, searchtext.Text.Length); } } hi, AutoComplete is an ASP.NET AJAX extender that can be attached to any TextBox control, and will associate that control with a popup panel to display words that begin with the prefix typed into the textbox. The dropdown with candidate words supplied by a web service is positioned on the bottom create a web service for auto complete extender then See the example below : http: / / www.asp.net / ajax / ajaxcontroltoolkit / samples / autocomplete / autocomplete.aspx Also see the implementation of AutoComplete extender in
Hi to All, Am doing one website. in this i hve to show categories is textbox with auto complete extender. i return a webservice for it. but am anble to call J Let’s explain how the AJAX Control AutoComplete works, 1. It attaches to a ASP.NET TextBox and 2. It grabs its information from a database or a web service method 3 can also style the results to have a Facebook style AutoComplete look. AutoComplete extends any ASP.NET TextBox control. It correlates that control with a popup panel to display words that commence with you can even use the AJAX Control ToolKit, you must add a ToolScriptManager to the page. You can do this 2 ways, you can both Drag and Drop the ToolScriptManager or
c: \ windows" ) ; return dir .GetFiles () .Where ( f = > f.Name.StartsWith ( prefixText ) ) .Select ( f = > f.Name ) .ToArray () ; } } File: AutoCompleteWebService.aspx <%@ Page Language = "C#" %> <%@ Register TagPrefix = "ajax" Namespace = "AjaxControlToolkit" Assembly = "AjaxControlToolkit" %> <!DOCTYPE html PUBLIC "- / / W3C / / DTD XHTML org / TR / xhtml1 / DTD / xhtml1-transitional.dtd" > <script runat = "server" > protected void btnSubmit_Click ( object sender, EventArgs e ) { lblSelectedFileName.Text = txtFileName.Text; } < / script> < html xmlns = "http: / / www.w3.org / 1999 / xhtml" > <head sm1" runat = "server" / > <asp:Label id = "lblFileName" Text = "File Name:" AssociatedControlID = "txtFileName" Runat = "server" / > <asp:TextBox id = "txtFileName" AutoComplete = "off" Runat = "server" / > <ajax:AutoCompleteExtender id = "ace1" TargetControlID = "txtFileName" ServiceMethod = "GetSuggestions" ServicePath WsiProfiles.BasicProfile1_1)] [ToolboxItem( false )] / / To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class SearchService : System.Web e89f-49c2-a93a-b290f013f649 / entity-framework-40-and-the-ajax-autocomplete-extender.aspx http: / / forums.asp.net / p / 1171061 / 2035655.aspx http: / / forums.asp.net / p / 1428568 / 3193449.aspx http: / / forums.asp