web service problem

Posted by Macson under ASP.NET on 6/23/2009 | Views : 1023 | Status : [Member] | Replies : 1
public string[] GetClientList(string prefixText)
{
DataSet dtst = new DataSet();
SqlConnection sqlCon = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
string strSql = "SELECT distinct CLIENT_NAME as CLIENT,CLIENT_ID FROM CLIENT_MASTER WHERE CLIENT_NAME LIKE '" + prefixText + "%' and IS_DELETED=0 ";
SqlCommand sqlComd = new SqlCommand(strSql, sqlCon);
sqlCon.Open();
SqlDataAdapter sqlAdpt = new SqlDataAdapter();
sqlAdpt.SelectCommand = sqlComd;
sqlAdpt.Fill(dtst);
string[] cntName = new string[dtst.Tables[0].Rows.Count];
int[] cntID = new int[dtst.Tables[0].Rows.Count];
int i = 0;
try
{
foreach (DataRow rdr in dtst.Tables[0].Rows)
{
cntName.SetValue(rdr["CLIENT"].ToString(), i);
cntID.SetValue(Convert.ToInt32(rdr["CLIENT_ID"]), i);
cid = cntID[i];
Session["CLIENT_ID"] = cid;
i++;

//Cid =Convert.ToInt32(cntID);

}

}
catch { }
finally
{
sqlCon.Close();
}
return cntName;
// return cntID;


}
using this query i can find the client name whwatever i type in the textbox suppose i type "a" it populate the list of word start from "a", but when i type "ab" it populate the word start from "ab" but not this type of word "ai bal"how to do tht




Responses

Posted by: Vuyiswamb on: 6/24/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Good Morning Macson

Set your Textbox Autopostback Property to "true" Do the same to the Gridview or any other Control that you are using to display data and Bind the Grid on textchange event of your Textbox. use ajax update Panel to get rid of the page Flickering.

Hope this Helps

Thank you for Posting at Dotnetfunda

Vuyiswa Maseko


Thank you for posting at Dotnetfunda
[Administrator]

Macson, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response