Gopi
Gopi

Reputation: 140

How to get value from selected checkbox in ASP gridview?

I have a grid view with number of pages.using check box i like to get value of selected check boxes. i have no idea to get value from selected check boxes in different pages.Please give me your suggestion and coding for this.

Upvotes: 0

Views: 9307

Answers (2)

Arun Singh
Arun Singh

Reputation: 63

Use this one

protected void btnClick_Click(object sender, EventArgs e)
{ 
    StringBuilder sbQuery = new StringBuilder();
    bool flag = false;
    foreach (GridViewRow row in gridview1.Rows)
    {

        if (((CheckBox)row.FindControl("chk")).Checked)
        {
            flag = true;
           //------

        }

    }


}

Upvotes: 1

Just code
Just code

Reputation: 13801

As you have illustarted in question i am assuming that you want checkboxes values so i have one linke which i providing you this will help you to understand how would you achieve and also i am recommanding you to use javascript

Get the value of checked checkbox?

this is javascript i have other links of gridview also

http://forums.asp.net/t/1125079.aspx

How to get checkbox value from gridview when checkbox OnCheckedChanged

regards...:)

Upvotes: 1

Related Questions