子网格SelectionChanged事件不会在DevExpress中触发

时间:2013-04-12 13:16:44

标签: c# asp.net devexpress

我有2个ASPxGridView控件   - gvPatient和 - gvOrder  gvOrder放在gvPatient的详细行模板中。  我正在设置的问题是我必须更改焦点行上的gvOrder(子)行的值或更改选择。我有这些事件的代码,但这些事件不会触发选择更改的行和焦点更改子网格。奇怪的是 - 这里这些子网格事件触发了gvPatient(父)行选择并且焦点发生了变化。

代码:

<%@ 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>

1 个答案:

答案 0 :(得分:0)

您需要设置属性SettingsBehavior.ProcessSelectionChangedOnServerSettingsBehavior.ProcessFocusedRowChangedOnServer为真 从docs:“如果ProcessSelectionChangedOnServer属性设置为false,则在客户端处理ASPxClientGridView.SelectionChanged事件而不回发到服务器”。