Try doing this.. it should work
Replace this code :
ddlItems.DataSource = dsCategory;
ddlItems.DataMember = "Categories";
ddlItems.DataTextField = "Description";
With
ddlItems.DataSource = dsCategory;
ddlItems.DataValuefield = "CategoryId";
ddlItems.DataTextField = "CategoryName";
and also puut all your code under Page_Load like this
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostback)
{
//This code is filling in the Dropdownlist with data from Category table
// your complete Dropdown code here
}
}
and in your SelectedIndexChanged function
change this
DataSet dsItems = new DataSet(); daItems.SelectCommand.CommandText = "Select ProductName, UnitPrice, UnitsInStock, ProductImage from dbo.Products where CategoryID = " + [B]ddlItems.SelectedValue[/B];
Last edited by peter_budo; Dec 3rd, 2008 at 7:00 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Njoy koding... >>>