how to get value of checkboxes in datagrid

hi All
hav a good day

i have a window form
on this form i hav a datagrid view. i hav add a checkbox column and three bounded columns productname,price and quantity.
These three columns are filled in datagridview from database.
This checkbox column is for select the products.
supose gridview has 6 products and at the run time user select 4 products by clicking on checkboxes.
 then i want to get all three values (product name,price,quantity) for these four products  for which checkbox column is checked.

Any help will be appriciated.
Thanks in Advance.
sidharth
psaini172000Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ivo StoykovCommented:
below is a small sample
StringBuilder str = new StringBuilder();
 
// Select the checkboxes from the GridView control
 
for (int i = 0; i < GridView1.Rows.Count; i++)
{
  GridViewRow row = GridView1.Rows[i];
  bool isChecked = ((CheckBox) row.FindControl("chkSelect")).Checked;
 
  if (isChecked)
  {
    // Column 2 is the name column
 
    str.Append(GridView1.Rows[i].Cells[2].Text);
  }
}
 
// prints out the result
 
Response.Write(str.ToString());

Open in new window

0
psaini172000Author Commented:
hi
My problem is not on webapplication
it is on windows application. Thats why ur solution dont work

Thanks for this help
0
psaini172000Author Commented:
if Any Body hav any idea pls help
Thanks
0
Ivo StoykovCommented:
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.