<cc1:AutoCompleteScriptControl Width="200px" ID="txtProductSearchPostBack" runat="server"
DataTextField="Name" DataValueField="Id" SelectMethod="GetList"
TypeName="WebExtenderAjax.ProductManager" CompletionInterval="200">
<SelectParameters>
<asp:ControlParameter ControlID="txtProductSearchPostBack" Name="name" PropertyName="Text" />
</SelectParameters>
</cc1:AutoCompleteScriptControl>
namespace WebExtenderAjax
{
public class ProductManager
public Product GetProduct(int Id)
Product e = null;
SqlConnection conn = new SqlConnection(WebExtenderAjax.Properties.Settings.Default.AdvConnectionString);
SqlCommand comm = new SqlCommand("Select * from Production.Product where ProductID = @ProductID", conn);
SqlParameter p = new SqlParameter("@ProductID", SqlDbType.Int);
p.Value = Id;
comm.Parameters.Add(p);
conn.Open();
try
SqlDataReader dr = comm.ExecuteReader();
while (dr.Read())
e = new Product();
e.Id = (int)dr["ProductID"];
e.ProductNumber = (String)dr["ProductNumber"];
e.Name = (String)dr["Name"];
e.SellStartDate = (DateTime)dr["SellStartDate"];
}
dr.Close();
catch (Exception ex)
Debug.WriteLine(ex.Message);
finally
conn.Close();
return e;