$("[id$=" + target + "]").find('[id$="rmMenu"]').disable();
All this looks pretty strange to me. I am fairly new to Telerik controls, so I may have missed something...
Any idea?
Thank you!
viktor
<telerik:RadGrid runat="server" ID="rgStudentExtractRequest"
AutoGenerateColumns="false" AllowSorting="false" AllowPaging="false" OnItemCreated="rgStudentExtractRequest_ItemCreated"
Width="780px">
<PagerStyle Mode="NumericPages" />
<MasterTableView DataKeyNames="AcademicYear" AllowMultiColumnSorting="True" HierarchyLoadMode="ServerBind"
GroupLoadMode="Server">
<DetailTables>
<telerik:GridTableView DataKeyNames="AcademicYear" Width="100%" AllowSorting="false" >
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="AcademicYear" MasterKeyField="AcademicYear" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn DataField="Subject" SortExpression="Subject" HeaderText="Subject" Display="true" />
<telerik:GridBoundColumn UniqueName="SubjectCd" DataField="SubjectCd" Display="false" />
<telerik:GridTemplateColumn UniqueName="clmSelect" HeaderText="Full" Display="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" >
<ItemTemplate >
<asp:CheckBox ID="chkSelect" runat="server" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="clmRuleEdition" HeaderText="Rule Edition" Display="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" >
<ItemTemplate >
<asp:CheckBox ID="chkRuleEdition" runat="server" Enabled="true" />
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
<Columns>
<telerik:GridBoundColumn DataField="AcademicYear" SortExpression="AcademicYear" HeaderText="" Display="true" />
</Columns>
</MasterTableView>
</telerik:RadGrid>
Script (Event set up in code behind):
function clicked_chkSelect(chkbox, itemId) {
var tableView = $find(itemId.split("__")[0]);
tableView.get_dataItems();
var row = $find(itemId);
var chkFull = chkbox;
var chkRuleEdition = row.findElement("chkRuleEdition");
if (chkFull.checked == false) {
chkRuleEdition.checked =
false;
chkRuleEdition.disabled =
true;
}
else {
chkRuleEdition.disabled =
false;
chkRuleEdition.parentElement.removeAttribute(
"disabled");
}
}
ItemCreated Event (This only seems to set up the Grid on Load, not when the expanded process happens, even though I can trap in Debugger):
Protected Sub rgStudentExtractRequest_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs)
Try
If e.Item.GetType Is GetType(GridDataItem) Then
Dim item As GridDataItem = CType(e.Item, GridDataItem)
'if this item is from a detail table
If (item.OwnerTableView IsNot rgStudentExtractRequest.MasterTableView) Then
Dim chkSelect As CheckBox = CType(item.FindControl("chkSelect"), CheckBox)
Dim chkRuleEdition As CheckBox = CType(item.FindControl("chkRuleEdition"), CheckBox)
'pass the ClientID of the row itself. We can extract the detail table ID from it
If chkSelect IsNot Nothing Then
chkSelect.Attributes.Add(
"onclick", "clicked_chkSelect(this,'" + item.ClientID + "')")
End If
If chkRuleEdition IsNot Nothing andalso chkSelect isnot Nothing andalso chkSelect.Checked = False Then
chkRuleEdition.Enabled =
False
ElseIf chkRuleEdition IsNot Nothing Then
chkRuleEdition.Enabled =
True
End If
End If
End If
Catch ex As Exception
MessageWindowLogWithError(, ,
Message.Icon.Err, ex, , PageName, System.Reflection.MethodBase.GetCurrentMethod.Name)
End Try
End Sub
<%@ Page Title="" Language="VB" MasterPageFile="~/site.master" AutoEventWireup="false" CodeFile="securitymanagement.aspx.vb" Inherits="pages_securitymanagement" %> <asp:Content ID="HeaderContent" ContentPlaceHolderID="SiteHeadContent" Runat="Server"> </asp:Content> <asp:Content ID="BodyContent" ContentPlaceHolderID="SiteBodyContent" Runat="Server"> <telerik:RadAjaxManager ID="RadAjaxManager" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="SearchForObject"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="ObjectList" LoadingPanelID="RadAjaxLoadingPanel" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel" Runat="server" /> <telerik:RadSplitter runat="Server" ID="SiteParent" Width="100%" BorderSize="0" BorderStyle="None" PanesBorderSize="0" Height="100%" Orientation="Vertical" VisibleDuringInit="false"> <telerik:RadPane ID="LeftPane" runat="server" Width="300px" Scrolling="None"> <div class="padding20"> <h4>Security Tasks</h4> <div class="padding10top"> <asp:RadioButtonList ID="SecurityTasks" runat="server" AutoPostBack="true"> <asp:ListItem Text="Role Management" Value="0" Selected="True" /> <asp:ListItem Text="Membership Managment" Value="1" /> </asp:RadioButtonList> </div> </div> </telerik:RadPane> <telerik:RadPane ID="RightPane" runat="server" Scrolling="Both" Height="100%" CssClass="panefix"> <div class="padding20"> <telerik:RadMultiPage ID="MultiPage" SelectedIndex="0" RenderSelectedPageOnly="true" runat="server"> <telerik:RadPageView ID="RolesPage" runat="server"> <h4>Role Management</h4> <div class="padding10top"> <div class="floatleft"> <asp:Panel ID="CurrentRolesGroup" runat="server" GroupingText="Current Roles"> <div class="padding10"> <div> <telerik:RadListBox ID="RolesList" runat="server" Height="300px" AutoPostBack="true" Width="255px" DataSourceID="RoleManagementDataSource" DataKeyField="RoleName" DataSortField="RoleName" DataTextField="RoleName" DataValueField="RoleName" /> </div> <div class="padding10top"><telerik:RadButton ID="RemoveRole" Text="Remove" runat="server" Width="100px" /></div> </div> </asp:Panel> </div> <div class="floatleft padding20left"> <asp:Panel ID="RolePermissionsGroup" runat="server" GroupingText="Role Permissions"> <div class="padding10"> <div> <telerik:RadListBox ID="RolePermissions" runat="server" Height="300px" Width="255px" CheckBoxes="true" DataSourceID="PermissionsDataSource" DataKeyField="permission_id" DataTextField="name" DataValueField="permission_id" Enabled="false" /> </div> <div class="padding10top"><telerik:RadButton ID="ApplyPerms" Text="Apply" runat="server" Width="100px" /></div> </div> </asp:Panel> </div> <div class="floatleft clear"> <asp:Panel ID="NewRoleGroup" runat="server" GroupingText="Role Permissions"> <div class="padding10"> <div><telerik:RadTextBox ID="NewRole" runat="server" Width="250px" /></div> <div class="padding10top"><telerik:RadButton ID="AddRole" Text="Add" runat="server" Width="100px" /></div> </div> </asp:Panel> </div> </div> </telerik:RadPageView> <telerik:RadPageView ID="MembershipPage" runat="server"> <h4>Membership Management</h4> <div class="padding10top"> <div class="floatleft"> <asp:Panel ID="RoleMembersGroup" runat="server" GroupingText="Current Roles"> <div class="padding10"> <div>Select Role:</div> <div> <asp:DropDownList ID="SelectRole" runat="server" DataSourceID="RoleManagementDataSource" DataTextField="RoleName" DataValueField="RoleName" AutoPostBack="true" Width="250px" /> </div> <div class="padding10top"> <telerik:RadListBox ID="MembersList" runat="server" Height="300px" Width="255px" DataSourceID="MembersDataSource" DataKeyField="UserName" DataTextField="UserName" DataValueField="UserName" /> </div> <div class="padding10top"><telerik:RadButton ID="RemoveMember" Text="Remove" runat="server" Width="100px" /></div> </div> </asp:Panel> </div> <div class="floatleft padding20left"> <asp:Panel ID="SearchMembersGroup" runat="server" GroupingText="Role Permissions"> <div class="padding10"> <div>Search User or Group:</div> <div><telerik:RadTextBox ID="ObjectToSearch" runat="server" Width="350px" /></div> <div class="padding10top"> <telerik:RadListBox ID="ObjectList" runat="server" Height="300px" Width="355px" Sort="Ascending" /> </div> <div class="padding10top"> <telerik:RadButton ID="SearchForObject" Text="Search" runat="server" Width="100px" /> <telerik:RadButton ID="AddObject" Text="Add" runat="server" Width="100px" /> </div> </div> </asp:Panel> </div> </div> </telerik:RadPageView> </telerik:RadMultiPage> </div> </telerik:RadPane> </telerik:RadSplitter> <asp:SqlDataSource ID="RoleManagementDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:aspcfg_db %>" SelectCommand="aspnet_Roles_GetAllRoles" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:Parameter Name="ApplicationName" DefaultValue="MAC" Type="String" /> </SelectParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="PermissionsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:mac_db %>" SelectCommand="Permissions_GetAllPermissions" SelectCommandType="StoredProcedure"> </asp:SqlDataSource> <asp:SqlDataSource ID="MembersDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:aspcfg_db %>" SelectCommand="aspnet_UsersInRoles_GetUsersInRoles" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:ControlParameter ControlID="SelectRole" Name="RoleName" PropertyName="SelectedValue" Type="String" /> <asp:Parameter Name="ApplicationName" DefaultValue="MAC" Type="String" /> </SelectParameters> </asp:SqlDataSource> </asp:Content> Protected Sub SearchForObject_Click(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles SearchForObject.Click If Not ObjectToSearch.Text = String.Empty Then ObjectList.Items.Clear() Dim searchedObjects As SearchResultCollection = SearchForUsersGroups(ObjectToSearch.Text) For Each oneObject As SearchResult In searchedObjects Dim item As RadListBoxItem If oneObject.Properties.Contains("displayName") Then item = New RadListBoxItem( _ oneObject.Properties("displayName")(0).ToString, _ oneObject.Properties("distinguishedName")(0).ToString) Else item = New RadListBoxItem( _ oneObject.Properties("name")(0).ToString, _ oneObject.Properties("distinguishedName")(0).ToString) End If ObjectList.Items.Add(item) Next ObjectList.SortItems() End IfEnd Sub