Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends,
I have Two tables Product,Category Table.I apply Join On both and show in grid view.
SELECT Products.ProductSNo, Products.ProductName, Products.ProductDescription, Products.ProductPrice,Products.ProductQuantity, Products.ProductImage, Category.CategoryName
FROM [Products] INNER JOIN
[Category]
ON Products .CategorySNO = Category.CategorySNo


I take a drop down for CategoreyName at the time of Editing in grid vIew.
Now my Question Is How to Update CategorySNo in Products Table.
Or how to fetch CategorySNo value From Drop Down.
Posted
Comments
Samira Radwan 9-Sep-15 16:29pm    
in your dropdownlist assign The category name to DataTextField property and CatId to DataValueField. in your code insert or update CatId by selecting dropdownlist.SelectedValue.ToString().
Member 11804811 10-Sep-15 1:41am    
ThankYou Samira

1 solution

Samira is correct. When you bind the dropsown, you should bind the text field as DataTextField and id field as DataValueField.

So, when you update the grid, while looping through the rows, you can find the drop down SelectedValue and do whatever you want to do with that.
 
Share this answer
 
Comments
aarif moh shaikh 10-Sep-15 0:31am    
yes,agree with you.
Thanks man :)
Member 11804811 10-Sep-15 1:41am    
Thankyou All...
Most welcome buddy :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900