1.Add Itemplate as label
and call javscript function on onclick event of label with passing id of this label.
code:
<ItemTemplate >
<asp:Label ID="lblCompany" runat="server" Text='<%# Bind("Company")%>' onClick="return FunctionName(event,this);" contentEditable="true"></asp:Label>
</ItemTemplate>
javscript:
fucntion functionname(e,ctrl)
{
//from this you can get current row index and cellindex by using this you can make
var row=ctrl.offsetParent.parentNode.rowIndex;
var cell=ctrl.offsetParent.cellIndex;
var gdv = document.getElementById('GridView1');
gdv.rows(row).cells(column number of your checkbox column).children.item(0).checked=true;
}
Or
2.you directly call javascript function on gridview click
code:
<asp:GridView ID="GridView1" runat="server" Width="80%" onClick="return return FunctionName(event,this);" >
javscript:
fucntion functionname(e,ctrl)
{
var gdv = document.getElementById('GridView1');
//from this you can get current row index and cellindex by using this you can make
var row=ctrl.document.activeElement.parentElement.rowIndex;
var cell=ctrl.document.activeElement.cellIndex;
gdv.rows(row).cells(column number of your checkbox column).children.item(0).checked=true;
}
I hope it helps you