Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have two columns in datagridview named as 'dgvcategory' and 'dgvproduct'...here i wanna to add value in dgvproduct based on category selected in each row...am tried cellendedit even for datagridview to get the value but its change every column values while am select category in each row....so i need your help, how we retrieve product value based category selected in each row without affecting Existing rows..

Thanks in Advance
Posted
Comments
J.Karthick 4-Jul-11 3:10am    
Hi sathya,
I think you should get the row index of that particular Category you are selected and assign that respective product value to the particular Row Index's Product value.
Nathansathya 4-Jul-11 3:23am    
Hi Karthick,
we cant add values based on row index...I already tried but it cant work....Because we accept cell values using row index ....but cant add more than one value to a cell using row index...

1 solution

Hello,

try to use dropdownlist in grid so that you can have multiple values.

you can get multiple links on how to use dropdownlist with gridview.


thanks
sanjeev
 
Share this answer
 
Comments
Nathansathya 4-Jul-11 3:37am    
Hi Sanjeev,

am using DataGridViewComboBoxColumn only...here values are added in DataGridViewComboBoxColumn by selecting Category but ma problem is values are added in each row of DataGridViewComboBoxColumn which replace exists values by selecting Category..i need to avoid this any one can help me ......
[no name] 4-Jul-11 3:41am    
hoping you are having one- one combination i.e if you are changing one category from row1 then the product of row1 get the current category's Product right ??
Nathansathya 4-Jul-11 3:49am    
yeah you said right...am having 5 categories each one have different products so i have to get current product list for selected category without affecting previous rows....
[no name] 4-Jul-11 3:53am    
fire the query on seletedindex changed method and rebind the gridview.
Nathansathya 4-Jul-11 4:25am    
i cant get you sanjeev..can you explain clearly

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