0

我有一个填充一些事务的 ASPxGridView。

<dx:ASPxGridView ID="grdCapTrans" runat="server" ClientIDMode="AutoID" Width="100%"   EnableRowsCache="false">
</dx:ASPxGridView>

当它填充时,我想让用户自由选择一行并查看单击行的详细信息。详细信息应显示在文本框中的网格视图下方。

如何在服务器上触发和处理?

4

2 回答 2

0

您可以使用RowCommand event

链接:http://documentation.devexpress.com/#AspNet/DevExpressWebASPxGridViewASPxGridView_RowCommandtopic

<dx:ASPxGridView ID="grid" 
runat="server" 
ClientInstanceName="grid" 
AutoGenerateColumns="false" 
onrowcommand="grid_RowCommand" >
   <Columns>
     <dx:GridViewCommandColumn ShowSelectCheckbox="true" VisibleIndex="0" ButtonType="Button" />
   </Columns>
 </dx:ASPxGridView>

代码背后:

 protected void grid_RowCommand(object sender, ASPxGridViewRowCommandEventArgs e)
 {
    ..... 
 }

绑定您的数据

grid.DataSource = ...;
grid.DataBind();

链接:http ://documentation.devexpress.com/#AspNet/DevExpressWebASPxGridViewASPxGridView_RowDeletingtopic

于 2012-09-20T08:42:32.787 回答
0
<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";


}

消息元素是一个 div,可在 updatepanel1 中找到。如果 selectionChanged 事件触发,我希望显示消息“Happy”。令我惊讶的是,它没有。

出了什么问题,如何纠正。

于 2012-09-21T08:26:57.117 回答