I want to apply role management in a grid
I have 3 tables in the database 1. Role master 2.Action Master 3.RoleActionAssociation
the procedure is
@RoleID int
as
select actionname,isnull(ra.actionid,0) from actionmaster
left outer join
(select actionid from roleactionassociation where roleid=@RoleID
) ra
on (actionmaster.actionid=ra.actionid)
now this gets me all the names of the actions present alongside the actionids
if the role is associated then the actionid is displayed else its null
Now I want to display this in the grid ie if the actionid is null I need the checkbox to be checked else unchecked
Rad Grid is as follows
<telerik:RadGrid AutoGenerateDeleteColumn="true" ID="RolesActionsGrid" runat="server" AutoGenerateColumns="False" AllowAutomaticInserts="false"
AllowAutomaticDeletes="false" AllowPaging="true" allowSorting="true">
<MasterTableView>
<Columns>
<telerik:GridBoundColumn DataField="ActionName" HeaderText="Permissions" SortExpression="ActionName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ActionID" Visible="false" HeaderText="Permissions" SortExpression="ActionID">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn>
<HeaderTemplate>
<asp:CheckBox runat="server" id="checkAll"/>
</HeaderTemplate>
<ItemTemplate >
<asp:CheckBox id="checkIndividual" runat="server" />
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
code behind
Protected Sub DDRoles_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles DDRoles.SelectedIndexChanged
Dim objActions As New clsActionMaster
Dim objDataTable As New DataTable
objDataTable = objActions.getActionsByRoleID(15).Tables(0)
RolesActionsGrid.DataSource = objDataTable
RolesActionsGrid.DataBind()
End Sub
Protected Sub RolesActionsGrid_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles RolesActionsGrid.DataBound
For Each item As GridDataItem In RolesActionsGrid.Items
Next
End Sub
Even when I check uncheck the checkbox an appropriate function shld be called
I have 3 tables in the database 1. Role master 2.Action Master 3.RoleActionAssociation
the procedure is
@RoleID int
as
select actionname,isnull(ra.actionid,0) from actionmaster
left outer join
(select actionid from roleactionassociation where roleid=@RoleID
) ra
on (actionmaster.actionid=ra.actionid)
now this gets me all the names of the actions present alongside the actionids
if the role is associated then the actionid is displayed else its null
Now I want to display this in the grid ie if the actionid is null I need the checkbox to be checked else unchecked
Rad Grid is as follows
<telerik:RadGrid AutoGenerateDeleteColumn="true" ID="RolesActionsGrid" runat="server" AutoGenerateColumns="False" AllowAutomaticInserts="false"
AllowAutomaticDeletes="false" AllowPaging="true" allowSorting="true">
<MasterTableView>
<Columns>
<telerik:GridBoundColumn DataField="ActionName" HeaderText="Permissions" SortExpression="ActionName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ActionID" Visible="false" HeaderText="Permissions" SortExpression="ActionID">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn>
<HeaderTemplate>
<asp:CheckBox runat="server" id="checkAll"/>
</HeaderTemplate>
<ItemTemplate >
<asp:CheckBox id="checkIndividual" runat="server" />
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
code behind
Protected Sub DDRoles_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles DDRoles.SelectedIndexChanged
Dim objActions As New clsActionMaster
Dim objDataTable As New DataTable
objDataTable = objActions.getActionsByRoleID(15).Tables(0)
RolesActionsGrid.DataSource = objDataTable
RolesActionsGrid.DataBind()
End Sub
Protected Sub RolesActionsGrid_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles RolesActionsGrid.DataBound
For Each item As GridDataItem In RolesActionsGrid.Items
Next
End Sub
Even when I check uncheck the checkbox an appropriate function shld be called