在DevExpress中没有触发子网格SelectionChanged事件

本文关键字:网格 SelectionChanged 事件 DevExpress | 更新日期: 2023-09-27 18:08:45

我有两个ASPxGridView控件- gvPatient和——gvOrdergvOrder放置在gvPatient的详细行模板中。我面临的问题是,我必须获得gvOrder(子)行对焦点行改变或选择改变的值。我有这些事件的代码,但这些事件不着火的行和焦点改变了子网格的选择。奇怪的是,这里的这些子网格事件触发gvPatient(parent)行选择和焦点改变。

代码:

<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Main.master" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content" ContentPlaceHolderID="MainContent" runat="server">
    <table width="100%" border="0" cellpadding="2" cellspacing="2">
    <tr>
        <td>
        </td>
    </tr>
    <tr>
        <td style="height:300px;" valign="top">
            <dx:ASPxGridView ID="gvPatient" runat="server" AutoGenerateColumns="false"  DataSourceID="SqlDataSourceMaster"
                Width="100%" Font-Size="11px" KeyFieldName="PAT_NUMBER" >
                <Columns>
                    <dx:GridViewDataTextColumn Caption="PAT_NUMBER" FieldName="PAT_NUMBER"  Visible="false">
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataTextColumn Caption="" FieldName="PATIENT_ID"  Visible="false">
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataTextColumn Caption="Patient" FieldName="FULL_NAME" >
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataTextColumn Caption="MRN" FieldName="MRN" >
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataTextColumn Caption="Nursing Unit" FieldName="NURSING_UNIT">
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataTextColumn Caption="Room" FieldName="ROOM_BED" >
                    </dx:GridViewDataTextColumn>
                </Columns>
                <Templates>
                    <DetailRow>
                       <div style="padding:5px;">
                           <div>
                               <dx:ASPxGridView ID="gvOrder" runat="server" KeyFieldName="ORDER_KEY" DataSourceID="SqlDataSourceDetail"
                                Width="100%" AutoGenerateColumns="false"
                                nbeforeperformdataselect="gvOrder_BeforePerformDataSelect" 
                                OnSelectionChanged="gvOrder_SelectionChanged" 
                                onfocusedrowchanged="gvOrder_FocusedRowChanged" 
                                ondetailrowexpandedchanged="gvOrder_DetailRowExpandedChanged">
                                    <Columns>
                                        <dx:GridViewDataTextColumn Caption="ORDER KEY" FieldName="ORDER_KEY"  Visible="false">
                                        </dx:GridViewDataTextColumn>
                                        <dx:GridViewDataTextColumn Caption="PAT_NUMBER" FieldName="PAT_NUMBER"  Visible="false">
                                        </dx:GridViewDataTextColumn>
                                        <dx:GridViewDataTextColumn Caption="Rx Edit" FieldName="RX" >
                                        </dx:GridViewDataTextColumn>
                                        <dx:GridViewDataTextColumn Caption="Reason Code" FieldName="REASON_CODE" >
                                        </dx:GridViewDataTextColumn>
                                        <dx:GridViewDataTextColumn Caption="Note" FieldName="NOTE">
                                        </dx:GridViewDataTextColumn>
                                    </Columns>
                                <Settings ShowFooter="True" />
                                <SettingsBehavior AllowFocusedRow="true" AllowSelectByRowClick="true" />
                            </dx:ASPxGridView>
                           </div>
                           <div style="padding-top:5px; padding-left:5px;">
                                <table cellpadding="2" cellspacing="2" border="0" width="100%">
                                    <tr>
                                        <td rowspan="3">
                                            <dx:ASPxRoundPanel ID="ASPxRoundPanel2" runat="server" Width="500px" BackColor="White"
                                            HeaderText="PLEASE FOLLOW FEDERAL AND STATE GUIDELINES TO ORDER THIS CONTROLLED SUBSTANCE" >
                                                <PanelCollection>
                                                    <dx:PanelContent>
                                                         <table border="0" cellpadding="2" cellspacing="2" width="100%">
                                                            <tr>
                                                                <td align="left">
                                                                    <dx:ASPxLabel ID="ASPxLabel11" runat="server" Text="Start">
                                                                    </dx:ASPxLabel>&nbsp;&nbsp;&nbsp;
                                                                    <b><dx:ASPxLabel ID="ASPxLabel12" runat="server"  Text="04-04-13" Font-Bold="true" >
                                                                    </dx:ASPxLabel></b>
                                                                </td>
                                                                <td align="right">
                                                                 <dx:ASPxLabel ID="ASPxLabel13" runat="server" Text="Active" Font-Bold="true" >
                                                                    </dx:ASPxLabel>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td colspan="2">
                                                                    <dx:ASPxLabel ID="ASPxLabel14" runat="server" Text="Initial">
                                                                    </dx:ASPxLabel>&nbsp;&nbsp;&nbsp;
                                                                     <b><dx:ASPxLabel ID="ASPxLabel15" runat="server" Text="04-04-13" Font-Bold="true" >
                                                                    </dx:ASPxLabel></b>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td colspan="2">
                                                                     <dx:ASPxLabel ID="ASPxLabel16" runat="server" Text="Time Stamp">
                                                                    </dx:ASPxLabel>&nbsp;&nbsp;&nbsp;
                                                                     <b><dx:ASPxLabel ID="ASPxLabel17" runat="server" Text="04-04-13 02:53" Font-Bold="true" >
                                                                    </dx:ASPxLabel></b>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td colspan="2">
                                                                <dx:ASPxLabel ID="ASPxLabel18" runat="server" Text="OXYCODONE HCL IR 5MG TABLET (OXYCODONE HCL IR 5MB TABLET)" ></dx:ASPxLabel>
                                                                <br /><dx:ASPxLabel ID="ASPxLabel19" runat="server" Text="ONE TAB(5 mg) by mouth every 4 hours as neded pain tele order by bhardwaj, rakesh" ></dx:ASPxLabel>
                                                                <br /><dx:ASPxLabel ID="ASPxLabel20" runat="server" Text="noted on 04-04-13 2:53pm by erma entena, md" ></dx:ASPxLabel>
                                                                    &nbsp;
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </dx:PanelContent>
                                                </PanelCollection>
                                            </dx:ASPxRoundPanel>
                                        </td>
                                        <td>
                                            <dx:ASPxLabel ID="ASPxLabel1" runat="server" Text="Action:"></dx:ASPxLabel>
                                        </td>
                                        <td>
                                            <dx:ASPxComboBox ID="ASPxComboBox1" runat="server" ValueType="System.String" Width="300px" >
                                                <Items>
                                                    <dx:ListEditItem Text="" />
                                                    <dx:ListEditItem Text="Continue" />
                                                    <dx:ListEditItem Text="Discontinue" />
                                                    <dx:ListEditItem Text="Substitute" />
                                                    <dx:ListEditItem Text="Wean/Taper" />
                                                </Items>
                                            </dx:ASPxComboBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <dx:ASPxLabel ID="ASPxLabel3" runat="server" Text="Reason:"></dx:ASPxLabel>
                                        </td>
                                        <td>
                                            <dx:ASPxComboBox ID="cbReason" runat="server" ValueType="System.String" Width="300px" >
                                                <Items>
                                                    <dx:ListEditItem Text="" />
                                                    <dx:ListEditItem Text="Duplicate Drugs" />
                                                    <dx:ListEditItem Text="Ineffective drug therapy" />
                                                    <dx:ListEditItem Text="Non-compliance with drug therapy" />
                                                    <dx:ListEditItem Text="Significant side effects" />
                                                    <dx:ListEditItem Text="Significant drug interactions" />
                                                    <dx:ListEditItem Text="Behavioral Changes" />
                                                    <dx:ListEditItem Text="POLST/MOLST" />
                                                    <dx:ListEditItem Text="Refusing Medication" />
                                                </Items>
                                            </dx:ASPxComboBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <dx:ASPxLabel ID="ASPxLabel2" runat="server" Text="Comment:"></dx:ASPxLabel>
                                        </td>
                                        <td>
                                            <dx:ASPxMemo ID="tbNote" runat="server" Height="70px" Width="300px" ></dx:ASPxMemo>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            <dx:ASPxButton ID="btnSave" runat="server" Text="Save" onclick="btnSave_Click"></dx:ASPxButton>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            <dx:ASPxLabel ID="lblMsg" runat="server" Text="" ForeColor="Red"></dx:ASPxLabel>
                                        </td>
                                    </tr>
                                </table>
                           </div>
                       </div>
                    </DetailRow>
                </Templates>
                <SettingsDetail ShowDetailRow="true" AllowOnlyOneMasterRowExpanded="true" />
                <SettingsBehavior AllowFocusedRow="true" AllowSelectByRowClick="true" ProcessSelectionChangedOnServer="True" />
            </dx:ASPxGridView>
        </td>
    </tr>

在DevExpress中没有触发子网格SelectionChanged事件

需要设置属性SettingsBehavior。ProcessSelectionChangedOnServer和SettingsBehavior。ProcessFocusedRowChangedOnServer设置为true。
如果ProcessSelectionChangedOnServer属性被设置为false, ASPxClientGridView。SelectionChanged事件在客户端处理而不回发到服务器"