Protected Sub btnUpdateRole_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnUpdateRole.Click lblError.Text = "" Dim usergroup(0) As String usergroup(0) = ccode.wfgen(grdRoles.SelectedRow.Cells(1).Text) For Each row As GridViewRow In grdRoles.Rows Dim db As CheckBox = row.FindControl("CheckBox1") If db IsNot Nothing AndAlso db.Checked Then Try 'Roles.AddUsersToRoles(usergroup, row.Cells(1).Text) Catch ex As Exception End Try Else Try 'Roles.RemoveUserFromRoles(usergroup(0), row.Cells(1).Text) Catch ex As Exception End Try End If Next pnlAddCancel.Visible = False pnlRoles.Visible = False btnAddUser.Visible = True btnManageRoles.Visible = True GridView1.Columns(6).Visible = True GridView1.Columns(5).Visible = True GridView1.Columns(4).Visible = True GridView1.SelectedIndex = -1 End Sub
<asp:GridView ID="grdRoles" runat="server" DataSourceID="SqlDataSource2" AutoGenerateColumns="False" Width="100%" AllowSorting="True" DataKeyNames="Role_Name" Font-Names="Cambria" Font-Size="Small"> <Columns> <asp:BoundField DataField="Role_Name" HeaderText="Role_Name" SortExpression="Role_Name" ItemStyle-BackColor="White"> <ItemStyle BackColor="White" /> </asp:BoundField> <asp:TemplateField HeaderText="CheckBox" ShowHeader="False" SortExpression="CheckBox" ItemStyle-BackColor="White"> <ItemTemplate> <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Chk") %>' /> </ItemTemplate> <ItemStyle BackColor="White" /> </asp:TemplateField> </Columns> <PagerSettings Mode="NumericFirstLast" /> <SelectedRowStyle BackColor="White" /> <HeaderStyle BackColor="#A9C8EF" ForeColor="White" /> </asp:GridView>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)