Get the indexes of selected rows in GridView

前端 未结 2 1893
我在风中等你
我在风中等你 2021-02-06 14:22

I want get the rows I selected from gridview use a checkbox. The checkbox is like this!

2条回答
  •  难免孤独
    2021-02-06 14:43

    try this:

    protected void CheckBox1_CheckedChanged(object sender, System.EventArgs e)
    {
        CheckBox checkbox = (CheckBox)sender;
        GridViewRow row = (GridViewRow)checkbox.NamingContainer;
        if (checkbox.Checked == true) {
            row.BackColor = System.Drawing.Color.Red;
            mygridview.Columns(0).Visible = false;
        }
    }
    

提交回复
热议问题