I have 2 dropdownlist boxes on a Asp web page , they are both bound to a database , each one to a different table. I am using linq to sql to get the info from the table and display the results some text boxes.....the problem is when I select one Item from a dropdown ..it seems to get the info from both tables in the database...I have the code below for each of the dropdown list boxes....the code is in the selected index change event for both dropdown boxes
this is for the dropdown for the customers
this is the dropdown for the Inventory Item Numbers
Thank you for any help
-InkedGFX
this is for the dropdown for the customers
using (DB_ClassDataContext myDB = new DB_ClassDataContext(conn)) { var cust = from c in myDB.Customers where c.Company_Name == DropDownList3.Text select new { customer = c.Company_Name, contact = c.Contact_Name, phone = c.Bus_Phone, address = c.Address }; foreach (var item in cust) { txtContactName.Text = item.contact; txtPhone.Text = item.phone; txtCompanyAddress.Text = item.address; } }
this is the dropdown for the Inventory Item Numbers
using (DB_ClassDataContext Inv = new DB_ClassDataContext(conn)) { var inventory = from inv in Inv.Inventories where inv.ItemNumber == DropDownList2.Text select new { itemName = inv.ItemName, itemDesc = inv.ItemDesc, itemPrice = inv.ItemPrice }; foreach (var item in inventory) { txtItemName.Text = item.itemName; txtItemDesc.Text = item.itemDesc; txtItemPrice.Text = item.itemPrice.ToString(); } }
Thank you for any help
-InkedGFX