views:

38

answers:

2

The steps to get that rows in javascript as follows: how to Handle the RowDataBound event of the Grid?

how to Bind the ID OF EACH RECORD in checkbox attribute?

That’s all. Pls,help me to come out.

+1  A: 

There are lot of ways to handle ID in checkbox. 1. Multiple checkbox with the same 'name' attribute are handled over Form as comma separated value. So client side:

<input type="checkbox" name="a1" value="1"/>
<input type="checkbox" name="a1" value="2"/>
...

On server side looks like:

Request.Form["a1"]="1,2"

The second solution - place hidden field for each row with ID of row, so you could locate at jscript this hidden from row:

$get("myHidden", myRow)
Dewfy
A: 

You don't need to handle the RowDataBound event to do this. Use a CheckboxField...

<asp:GridView ID="GridView1" runat="server">
    <Columns>
        <asp:CheckBoxField DataField="FIELD_NAME_HERE" />
    </Columns>
</asp:GridView>
Josh Stodola