Click here to Skip to main content
15,906,463 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
protected void Button1_Click(object sender, EventArgs e)
    {
        for (int i = 0; i < GridView1.Rows.Count;i++ )
        {
            CheckBox chk = (CheckBox)GridView1.Rows[i].FindControl("CheckBox1") as CheckBox;
        }
    }



I am not able to get selected checkbox's values......if it checkbox is checked means it has delete that particular row after clicking on a delete button...


Anybody please help

PLease checkout snapshots below..

http://postimage.org/image/reucezmvb/[^]

http://s12.postimage.org/alslqk8q5/chk1.jpg[^]
Posted
Updated 6-Dec-12 20:45pm
v2
Comments
choudhary.sumit 7-Dec-12 2:27am    
where is your code block for checking the status of checkbox1??

1 solution

C#
protected void Button1_Click(object sender, EventArgs e)
    {
string str="";
        for (int i = 0; i < GridView1.Rows.Count;i++ )
        {
            CheckBox chk = (CheckBox)GridView1.Rows[i].FindControl("CheckBox1") as CheckBox;
           str=chk.SelectedItem.ToString();
        }
    }
 
Share this answer
 
Comments
PRAKASH_N 7-Dec-12 2:36am    
no..itz not working... str=chk.SelectedItem.ToString();
PRAKASH_N 7-Dec-12 2:46am    
http://postimage.org/image/reucezmvb/[^]

http://s12.postimage.org/alslqk8q5/chk1.jpg[^]
[no name] 7-Dec-12 2:48am    
first make chk.Checked = true;

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