i implement Ajax autoList on textbox, but when want insert into database how to get the selected row id. What is the syntax to get the selected row id?
<asp:TextBox ID="txtName" runat="server" CssClass="textbox" autocomplete="on"
AutoPostBack="True" ></asp:TextBox><asp:AutoCompleteExtender ID="txtName_AutoCompleteExtender" runat="server"
CompletionInterval="0" DelimiterCharacters="" Enabled="True"
FirstRowSelected="True" MinimumPrefixLength="1"
ServiceMethod="GetCompletionList" ServicePath="../AutoList.asmx" TargetControlID="txtName"
EnableCaching="true" ShowOnlyCurrentWordInCompletionListItem="True" CompletionListCssClass="completionList"></asp:AutoCompleteExtender> public string[] GetCompletionList(string prefixText, int count)
{
DataSet ds = new DataSet();
DataTable dt = new DataTable();
try
{
using (conn)
{
MySqlCommand SqlComm = new MySqlCommand("Select * from customer Where CustName like @param", conn);
SqlComm.Parameters.AddWithValue("@param", "%" + prefixText + "%");
conn.Open();
SqlComm.ExecuteNonQuery();
MySqlDataAdapter da = new MySqlDataAdapter(SqlComm);
da.Fill(ds);
}
}
catch
{
}
finally
{
conn.Close();
}
dt = ds.Tables[0];
List<string> txtItems = new List<string>();
String dvValues;
foreach (DataRow row in dt.Rows)
{
dvValues = row["CustName"].ToString();
dvValues = dvValues.ToLower();
txtItems.Add(dvValues);
}
return txtItems.ToArray();
}