0

我对 ASPxGridView 有疑问。我有一个 aspxgridview1 包含按钮。aspxgridview2 包含数据。当我按下按钮时。数据将显示在 aspxgridview1 的 aspgridview2 对应的“ID”上,但不会重新加载页面。这是在 aspxgridview1 之后

<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" KeyFieldName="Province_Id">
            <Columns>
                <dx:GridViewCommandColumn VisibleIndex="0">
                    <EditButton Visible="True">
                    </EditButton>
                    <ClearFilterButton Visible="True">
                    </ClearFilterButton>
                    <CustomButtons>
                        <dx:GridViewCommandColumnCustomButton ID="show" Text="show">
                        </dx:GridViewCommandColumnCustomButton>
                    </CustomButtons>
                </dx:GridViewCommandColumn>
                <dx:GridViewDataTextColumn FieldName="Province_Id" ReadOnly="True" VisibleIndex="1">
                    <EditFormSettings Visible="False" />
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="Name" VisibleIndex="2">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataButtonEditColumn VisibleIndex="4">
                </dx:GridViewDataButtonEditColumn>
            </Columns>
            <SettingsBehavior AllowFocusedRow="True" />
            <Settings ShowFilterRow="True" ShowFooter="True" ShowGroupPanel="True" ShowTitlePanel="True" />
        </dx:ASPxGridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TravelConnectionString %>" DeleteCommand="DELETE FROM [Province] WHERE [Province_Id] = @Province_Id" InsertCommand="INSERT INTO [Province] ([Name]) VALUES (@Name)" SelectCommand="SELECT * FROM [Province]" UpdateCommand="UPDATE [Province] SET [Name] = @Name WHERE [Province_Id] = @Province_Id">
            <DeleteParameters>
                <asp:Parameter Name="Province_Id" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="Name" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="Province_Id" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
4

1 回答 1

1

如果您打算使用ASPxGridViews,那么您能做的最好的事情就是将两个控件都包装在UpdatePanels 中。如果您不喜欢该解决方案,则需要考虑在单击按钮后使用 ajax 获取数据。

于 2013-06-19T20:15:12.427 回答