テレリックラドグリッドを使用しています。現在編集中のアイテムを展開して詳細を表示したい。OnCommand イベントが発生したときに起動する関数を作成しました。何が起こるかというと、細部が拡大し、再び収縮します! マスターまたは詳細の HierarchyLoadMode をどのように設定するかは関係ありません。考えられるすべての設定を試しましたが、マスター データ項目が編集モードになったときに展開されたままになりません。
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
CodeBehind="Users.aspx.cs" Inherits="WebCallManagerData.Account.Users" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<script type="text/javascript">
function OnCommand(sender, args)
{
if (args.get_commandName() == 'Edit')
{
rowIndex = args.get_commandArgument();
var radGrid = $find("<%= rgUsers.ClientID %>");
var dataItem = radGrid.get_masterTableView().get_dataItems()[rowIndex];
dataItem.set_expanded(true);
}
else if (args.get_commandName() == 'ExpandCollapse')
{
//dumpObject(args);
}
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:Label ForeColor="Red" Text="" ID="DisplayMessage1" runat="server" />
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="rgUsers">
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManagerProxy>
<telerik:RadGrid ID="rgUsers" runat="server" CellSpacing="0" DataSourceID="odsUsers"
GridLines="None" AutoGenerateColumns="False">
<ClientSettings>
<ClientEvents OnCommand="OnCommand" />
<Selecting CellSelectionMode="None"></Selecting>
</ClientSettings>
<MasterTableView DataSourceID="odsUsers" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
AllowAutomaticUpdates="True" DataKeyNames="UserName" HierarchyLoadMode="Client">
<DetailTables>
<telerik:GridTableView runat="server" DataSourceID="odsUserRole" AllowAutomaticUpdates="True"
AutoGenerateColumns="True" EditMode="EditForms" HierarchyLoadMode="Client">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="UserName" MasterKeyField="UserName" />
</ParentTableRelation>
<CommandItemSettings ExportToPdfText="Export to PDF" />
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
</ExpandCollapseColumn>
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" FilterControlAltText="Filter EditCommandColumn column">
</telerik:GridEditCommandColumn>
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column" UniqueName="EditCommandColumn1">
</EditColumn>
</EditFormSettings>
</telerik:GridTableView>
</DetailTables>
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" FilterControlAltText="Filter EditCommandColumn column">
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn DataField="UserName" FilterControlAltText="Filter UserName column"
HeaderText="UserName" SortExpression="UserName" UniqueName="UserName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Email" FilterControlAltText="Filter Email column"
HeaderText="Email" SortExpression="Email" UniqueName="Email">
</telerik:GridBoundColumn>
<telerik:GridCheckBoxColumn DataField="Approved" DataType="System.Boolean" FilterControlAltText="Filter Approved column"
HeaderText="Approved" SortExpression="Approved" UniqueName="Approved">
</telerik:GridCheckBoxColumn>
<telerik:GridCheckBoxColumn DataField="LockedOut" DataType="System.Boolean" FilterControlAltText="Filter LockedOut column"
HeaderText="LockedOut" SortExpression="LockedOut" UniqueName="LockedOut">
</telerik:GridCheckBoxColumn>
<telerik:GridBoundColumn DataField="Creation" FilterControlAltText="Filter Creation column"
HeaderText="Creation" SortExpression="Creation" UniqueName="Creation" DataType="System.DateTime">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="LastLogin" DataType="System.DateTime" FilterControlAltText="Filter LastLogin column"
HeaderText="LastLogin" SortExpression="LastLogin" UniqueName="LastLogin">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="LastActivity" DataType="System.DateTime" FilterControlAltText="Filter LastActivity column"
HeaderText="LastActivity" SortExpression="LastActivity" UniqueName="LastActivity">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="LastPasswordChanged" DataType="System.DateTime"
FilterControlAltText="Filter LastPasswordChanged column" HeaderText="LastPasswordChanged"
SortExpression="LastPasswordChanged" UniqueName="LastPasswordChanged">
</telerik:GridBoundColumn>
<telerik:GridCheckBoxColumn DataField="Online" DataType="System.Boolean" FilterControlAltText="Filter Online column"
HeaderText="Online" SortExpression="Online" UniqueName="Online">
</telerik:GridCheckBoxColumn>
<telerik:GridBoundColumn DataField="Password" FilterControlAltText="Filter Password column"
HeaderText="Password" SortExpression="Password" UniqueName="Password">
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
</EditFormSettings>
</MasterTableView>
<FilterMenu EnableImageSprites="False">
</FilterMenu>
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
</HeaderContextMenu>
</telerik:RadGrid>
<asp:ObjectDataSource ID="odsUserRole" runat="server" SelectMethod="GetUserRoles"
TypeName="WebCallManagerData.Account.MemberShipHelper.User" OldValuesParameterFormatString="original_{0}"
UpdateMethod="UpdateUserRoles">
<SelectParameters>
<asp:Parameter DefaultValue="" Name="UserName" Type="String" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="ur" Type="Object" />
<asp:Parameter Name="UserName" Type="String" />
</UpdateParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="odsUsers" runat="server" SelectMethod="GetAllUsers" TypeName="WebCallManagerData.Account.MemberShipHelper.User">
</asp:ObjectDataSource>
</asp:Content>