Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Oct 24, 2011 06:30 AM by Peter pi - MSFT
Member
23 Points
27 Posts
Oct 18, 2011 10:38 AM|LINK
hello friends...i m making textbox that shows suggession according to my letters i m typing...same as google
bt i m facing some problem
please help me out
web service code is
public ArrayList GetCompletionList(string prefixText) { ArrayList Postcode = new ArrayList(); ArrayList Postcode2 = new ArrayList();
DataTable dt = new DataTable(); string query = ""; query = "select * from postcode where Subrub not like '" + prefixText + "%' order by Subrub";
dt = Dataacess.GetDataTable(query, null); for (int i = 0; i < dt.Rows.Count; i++) { Postcode.Add(dt.Rows[i]["PostCode"].ToString()); }
return Postcode2;
}
my aspx code is
protected void Page_Load(object sender, EventArgs e) { try { string strQuery = "select * from postcode order by Subrub asc"; DataTable dt = new DataTable(); dt = Dataacess.GetDataTable(strQuery, null); if (dt != null) { rep.DataSource = dt; rep.DataBind(); } } catch (Exception ex) { throw ex; } }
All-Star
112752 Points
18373 Posts
Moderator
Oct 18, 2011 12:48 PM|LINK
Star
12871 Points
1786 Posts
Oct 24, 2011 06:30 AM|LINK
Hi,
Not sure what problem did you face? You can use Ajax AutoCompleteExtender to display the words begin with prefix typed into the textbox using asp.net. Here is a article about it using web service method to fetch the records from database.
http://www.aspdotnet-suresh.com/2011/03/how-to-implement-auto-complete-textbox.html
Best regards, Peter
tnmy_ptl
Member
23 Points
27 Posts
problem in autosuggession textbox
Oct 18, 2011 10:38 AM|LINK
hello friends...i m making textbox that shows suggession according to my letters i m typing...same as google
bt i m facing some problem
please help me out
web service code is
public ArrayList GetCompletionList(string prefixText)
{
ArrayList Postcode = new ArrayList();
ArrayList Postcode2 = new ArrayList();
DataTable dt = new DataTable();
string query = "";
query = "select * from postcode where Subrub not like '" + prefixText + "%' order by Subrub";
dt = Dataacess.GetDataTable(query, null);
for (int i = 0; i < dt.Rows.Count; i++)
{
Postcode.Add(dt.Rows[i]["PostCode"].ToString());
}
return Postcode2;
}
my aspx code is
protected void Page_Load(object sender, EventArgs e)
{
try
{
string strQuery = "select * from postcode order by Subrub asc";
DataTable dt = new DataTable();
dt = Dataacess.GetDataTable(strQuery, null);
if (dt != null)
{
rep.DataSource = dt;
rep.DataBind();
}
}
catch (Exception ex)
{
throw ex;
}
}
MetalAsp.Net
All-Star
112752 Points
18373 Posts
Moderator
Re: problem in autosuggession textbox
Oct 18, 2011 12:48 PM|LINK
Peter pi - M...
Star
12871 Points
1786 Posts
Re: problem in autosuggession textbox
Oct 24, 2011 06:30 AM|LINK
Hi,
Not sure what problem did you face? You can use Ajax AutoCompleteExtender to display the words begin with prefix typed into the textbox using asp.net. Here is a article about it using web service method to fetch the records from database.
http://www.aspdotnet-suresh.com/2011/03/how-to-implement-auto-complete-textbox.html
Best regards,
Peter
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework