<
asp:GridView ID
=
"
GridViewAllUser
"
runat
=
"
server
"
CellPadding
=
"
4
"
ForeColor
=
"
#333333
"
GridLines
=
"
None
"
AutoGenerateColumns
=
"
False
"
PageSize
=
"
1
"
RowHeaderColumn
=
"
UserID
"
DataSourceID
=
"
ObjectDataSource1
"
DataKeyNames
=
"
UserID
"
>
< FooterStyle BackColor = " #5D7B9D " Font - Bold = " True " ForeColor = " White " />
< RowStyle BackColor = " #F7F6F3 " ForeColor = " #333333 " />
< EditRowStyle BackColor = " #999999 " />
< SelectedRowStyle BackColor = " #E2DED6 " Font - Bold = " True " ForeColor = " #333333 " />
< PagerStyle BackColor = " #284775 " ForeColor = " White " HorizontalAlign = " Center " />
< HeaderStyle BackColor = " #5D7B9D " Font - Bold = " True " ForeColor = " White " />
< AlternatingRowStyle BackColor = " White " ForeColor = " #284775 " />
< Columns >
< asp:BoundField DataField = " UserID " HeaderText = " UserID " />
< asp:BoundField DataField = " UserName " HeaderText = " UserName " />
< asp:BoundField DataField = " LastActivityDate " />
< asp:TemplateField HeaderText = " IsApproved " SortExpression = " IsApproved " >
< EditItemTemplate >
< asp:CheckBox ID = " CheckBox1 " runat = " server " Checked = ' <%# Bind("IsApproved") %> ' />
</ EditItemTemplate >
< ItemTemplate >
< asp:CheckBox ID = " CheckBox1 " runat = " server " AutoPostBack = " True " Checked = ' <%# Bind("IsApproved") %> ' OnCheckedChanged = " CheckBox1_CheckedChanged "
/>
</ ItemTemplate >
</ asp:TemplateField >
</ Columns >
</ asp:GridView >
< asp:ObjectDataSource ID = " ObjectDataSource1 " runat = " server " SelectMethod = " GetAllRoles "
TypeName = " AgTrade.WebSite.admin.UserManage " ></ asp:ObjectDataSource >
< FooterStyle BackColor = " #5D7B9D " Font - Bold = " True " ForeColor = " White " />
< RowStyle BackColor = " #F7F6F3 " ForeColor = " #333333 " />
< EditRowStyle BackColor = " #999999 " />
< SelectedRowStyle BackColor = " #E2DED6 " Font - Bold = " True " ForeColor = " #333333 " />
< PagerStyle BackColor = " #284775 " ForeColor = " White " HorizontalAlign = " Center " />
< HeaderStyle BackColor = " #5D7B9D " Font - Bold = " True " ForeColor = " White " />
< AlternatingRowStyle BackColor = " White " ForeColor = " #284775 " />
< Columns >
< asp:BoundField DataField = " UserID " HeaderText = " UserID " />
< asp:BoundField DataField = " UserName " HeaderText = " UserName " />
< asp:BoundField DataField = " LastActivityDate " />
< asp:TemplateField HeaderText = " IsApproved " SortExpression = " IsApproved " >
< EditItemTemplate >
< asp:CheckBox ID = " CheckBox1 " runat = " server " Checked = ' <%# Bind("IsApproved") %> ' />
</ EditItemTemplate >
< ItemTemplate >
< asp:CheckBox ID = " CheckBox1 " runat = " server " AutoPostBack = " True " Checked = ' <%# Bind("IsApproved") %> ' OnCheckedChanged = " CheckBox1_CheckedChanged "
/>
</ ItemTemplate >
</ asp:TemplateField >
</ Columns >
</ asp:GridView >
< asp:ObjectDataSource ID = " ObjectDataSource1 " runat = " server " SelectMethod = " GetAllRoles "
TypeName = " AgTrade.WebSite.admin.UserManage " ></ asp:ObjectDataSource >
protected void CheckBox1_CheckedChanged( object sender, EventArgs e)
... {
CheckBox cb = sender as CheckBox;
GridViewRow gvr = cb.Parent.Parent as GridViewRow;
string userName = GridViewAllUser.DataKeys[gvr.RowIndex].Value.ToString();
}