Note that there are some explanatory texts on larger screens.

plurals
  1. POi want database driven autocomplete textbox using javascript and Database in c#
    primarykey
    data
    text
    <p>I want to list of airport names in my textbox fetch from my database for example when I type Las in text box. Textbox should give the lasvegas.</p> <p>Default.aspx.cs : </p> <pre><code>public string listFilter = null; protected void Page_Load(object sender, EventArgs e) { listFilter = BindName(); } private string BindName() { try { SqlConnection con = new SqlConnection(@"Data Source=172.16.10.170;Initial Catalog=cbtsv;User ID=cbtsv;Password=cbtsvpass;"); con.Open(); DataTable ds = new DataTable(); using (SqlCommand cmd = con.CreateCommand()) { SqlCommand com = new SqlCommand("select SearchKey from DTAirportCity where SearchKey like '%TextBox1.Text%'", con); SqlDataAdapter sda = new SqlDataAdapter(com); sda.Fill(ds); } StringBuilder output = new StringBuilder(); output.Append("["); for (int i = 0; i &lt; ds.Rows.Count; ++i) { output.Append("\"" + ds.Rows[i]["SearchKey"].ToString() + "\""); if (i != (ds.Rows.Count - 1)) { output.Append(","); } } output.Append("];"); return output.ToString(); con.Close(); } catch (Exception) { throw; } } </code></pre> <p>Default.aspx : </p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="Scripts/jquery-1.4.1.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"&gt;&lt;/script&gt; &lt;title&gt;&lt;/title&gt; &lt;script type="text/javascript"&gt; function LoadList() { var dt=null; dt = &lt;%=listFilter %&gt; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:TextBox ID="TextBox1" runat="server" OnLoad="LoadList()"&gt;&lt;/asp:TextBox&gt; &lt;br /&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p> </p> <p>Problem :- LoadList() function is not working.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload