Dim selectedProducts = GridView1.Rows.Cast(Of GridViewRow)().Where(Function(row) DirectCast(row.FindControl("SelectedProducts"), CheckBox).Checked).[Select](Function(row) GridView1.DataKeys(row.RowIndex).Value.ToString()).ToList()

it tell that is a negative number can u check that please

Member Avatar for LastMitch

how to display a checkbox in gridview why it is become negative

Maybe you can used the CommandArgument()?

CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>'

or this:

int iStID=int32.Parse(e.CommandArgument.ToString());
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.