Creating Auto suggest textbox control dynamically

Asked By new vel
09-Sep-10 01:05 AM
Earn up to 0 extra points for answering this tough question.
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
 

  re: Creating Auto suggest textbox control dynamically

Super Man replied to new vel
09-Sep-10 01:15 AM

  re: Creating Auto suggest textbox control dynamically

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


here u have the best and reliable Autosuggest .

http://jqueryui.com/demos/autocomplete/

and

http://www.brandspankingnew.net/archive/2006/08/ajax_auto-suggest_auto-complete.html

thank u.........

  re: Creating Auto suggest textbox control dynamically

[ 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
on add button click using javascript like: name age salary textbox textbox textbox(on add button click) textbox textbox textbox(on add button click) textbox textbox textbox(on add button click) there is also a delete button i want it on server side Is it runat server textbox control? Hi, the controls you have added will lost on
server side control in static web methods in c# using page.findcontrol("textbox") Page page = (Page)HttpContext.Current.Handler; Panel ltr = (Panel)page.FindControl("panelID"); but it return null in ltr object. . . . how controlName) { return RenderControl(controlName); } public static string RenderControl( string controlName) { Page page = new Page (); UserControl userControl = ( UserControl )page.LoadControl(controlName); userControl.EnableViewState = false ; HtmlForm form = new HtmlForm (); form
regarding ((TextBox)LoginView1.FindControl("UserName")).Text Can I do string A = (( TextBox )LoginView1.FindControl( "UserName" )).Text ? So, it depends on where you call this line of code. TextBox textBox = (TextBox)LoginView1.FindControl( "UserName" ); if textBox ! = null ) { string A = textBox.Text; } string A = ""; system.web.UI.webcontrol myControl = loginview1.findcontrol("username"); if ( (myControl ! = null) && (myControl.GetType() = = TypeOf(TextBox)) ) a = mycontrol.text; I am still getting same error: Message is the code (Register.aspx): protected void CreateUserWizard1_CreatedUser( object sender, EventArgs e) { string userStr = null ; string passStr = null ; string emailStr = null null ; string zipStr = null ; string cntyStr = null ; string phoneStr = null ; TextBox user = ( TextBox )LoginView1.FindControl( "UserName" ); if (user.Text ! = null ) { userStr
findcontrol in my page p1 = planetlist.SelectedValue.ToString(); foreach (Control page_control in Page.Controls) { foreach (Control c in page_control .Controls) { if (c is TextBox) { if (c = = (TextBox)Page.FindControl("txt1")) { ((TextBox)c).Text = p1.ToString(); } else if (c TextBox)Page.FindControl("TextBox1")) { ((TextBox)c).Text = p1.ToString(); } else if (c = = (TextBox)Page.FindControl("TextBox2")) { ((TextBox)c).Text = p1.ToString(); } } } } i wrote
validator code behind protected void lnkInsert_Click(object sender, EventArgs e) { TextBox name = (TextBox)TextBox.FindControl("name").ToString(); . . . . is it correct . . ??if not . . .make it correction protected void lnkInsert_Click(object sender, EventArgs e TextBox name = (TextBox)Page.FindControl("name"); or you can directly also access the text code beind fr tht . . .!!! You can access it directly using textbox name and Text property like this; protected void lnkInsert_Click(object sender, EventArgs e) { string strName = name.Text; } protected void lnkInsert_Click(object sender
Registration hii i am trying to insert data via registration page. TextBox Uid = utxt; TextBox Password = ptxt; TextBox ConfirmPassword = ctxt; TextBox FirstName = fnametxt; TextBox MiddleName = mnametxt; TextBox LastName = lnametxt; TextBox Sex = sextxt TextBox DOB = dobtxt; TextBox POB = pobtxt; TextBox FatherName = fathertxt; TextBox MotherName = mothertxt; TextBox SecurityQuestion
from dynamic created textboxes from a panel pls Help suppose textbox id is txt1: protected void Button2_Click( object sender, EventArgs e) { / / from page TextBox tx = ( TextBox )Page.FindControl( "txt1" ); Response.Write(tx.Text.ToString()); / / from panel TextBox txt = ( TextBox )Panel1.FindControl( "txt1" ); Response.Write(txt.Text.ToString()); } HI If controls, you have to create them in Page_PreInit for the page to properly process the events and viewstate. This will help you to write code like this for getting textbox values: TextBox tb = FindControl(BaseChildSectionName + i.ToString()) As TextBox; xtw
Master Pages in ASP.NET? or What is a Master Page? ASP.NET master pages allow you to create a consistent layout for the pages in your application. A single master page defines the look and feel and standard behavior that you users request the content pages, they merge with the master page to produce output that combines the layout of the master page with the content from the content page. What are the 2 important parts of a master page? The following are the 2 important parts of a master page 1. The Master Page itself 2. One or more Content Pages Can Master Pages be nested. What is the file extension for a Master Page? .master How do you identify a Master Page? The master page is identified by a special @ Master directive