<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" >
<Triggers>
<asp:AsyncPostBackTrigger ControlID="cboTransType" EventName="SelectedIndexChanged" />
</Triggers>
<ContentTemplate>
<dx:ASPxGridView ID="grdCapTrans" runat="server" ClientIDMode="AutoID" Width="100%" EnableRowsCache="false" ClientInstanceName="grdCapTrans" onselectionchanged="grdCapTrans_SelectionChanged"
EnableCallBacks="false" KeyFieldName="ID" AutoGenerateColumns="false">
<Columns>
<dx:GridViewCommandColumn ShowInCustomizationForm="True" VisibleIndex="0" ButtonType="Button" ShowSelectCheckbox="true"> </dx:GridViewCommandColumn>
<dx:GridViewDataTextColumn FieldName="ID" Name="ID" ShowInCustomizationForm="True" VisibleIndex="1"></dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="Description" Name="Description" ShowInCustomizationForm="True" VisibleIndex="2"></dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="Amount" Name="Amount" ShowInCustomizationForm="True" VisibleIndex="5"></dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="Date" Name="Date" ShowInCustomizationForm="True" VisibleIndex="4"></dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="Capturer" Name="Capturer" ShowInCustomizationForm="True" VisibleIndex="3"></dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="Status" Name="Status" ShowInCustomizationForm="True" VisibleIndex="6"></dx:GridViewDataTextColumn>
</Columns>
<SettingsBehavior ProcessSelectionChangedOnServer="true" AllowFocusedRow="true" AllowSelectByRowClick="true" EnableRowHotTrack="true" />
</dx:ASPxGridView>
<p>
</p>
</ContentTemplate>
</asp:UpdatePanel>
代碼後面
protected void grdCapTrans_SelectionChanged(object sender, EventArgs e)
{
UpdatePanel1.Update();
txtFullName.Text = grdCapTrans.GetSelectedFieldValues("Description")[1].ToString();
message.InnerHtml = "Happy";
}
消息元件是在發現updatepanel1一個div。如果selectionChanged事件觸發,我期待顯示「Happy」消息。令我驚訝的是,它沒有。
什麼錯了,怎麼可以糾正。
試試本演示:[通過單擊狀態欄按鈕或雙擊某一行切換到編輯模式](http://www.devexpress.com/Support/Center/e/E7.aspx) – Filip