小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

asp.net ajax技巧-主從gridview動態(tài)更新

 悟靜 2012-04-30
下面是異步的一對多流程,有兩個gridview,上面一個gridview是主,下面一個GRIDVIEW顯示的是從,當點
主表的數(shù)據(jù)時,下面的GRIDVIEW顯示對應的數(shù)據(jù)(DETAIL),要注意的是,為了防止浪費時間,把兩個GRIDVIEW
放到兩個不同的updatepannel中去,并且設(shè)計兩個UPDATEPANNEL控件的updatemode屬性為conditional,這樣當在下方的GRIDVIEW控件排序時,上方的UPDATEPANNEL控件不會被局部更新
  <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <asp:UpdatePanel ID="OrdersPanel" UpdateMode="Conditional" runat="server">
                <ContentTemplate>
                    <asp:GridView ID="GridView1" AllowPaging="True" AllowSorting="True" Caption="訂貨主檔的訂單數(shù)據(jù)"
                        DataKeyNames="訂單號碼" DataSourceID="SqlDataSource1" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
                        runat="server" Width="608px" BackColor="LightGoldenrodYellow" BorderColor="Tan"
                        BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None" SelectedIndex="0"
                        OnPageIndexChanged="GridView1_PageIndexChanged">
                        <Columns>
                            <asp:CommandField ShowSelectButton="True"></asp:CommandField>
                        </Columns>
                        <FooterStyle BackColor="Tan" />
                        <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
                        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
                        <HeaderStyle BackColor="Tan" Font-Bold="True" />
                        <AlternatingRowStyle BackColor="PaleGoldenrod" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:chtNorthwind %>"
                        SelectCommand="SELECT 訂單號碼,客戶編號,員工編號,訂單日期 FROM dbo.訂貨主檔"></asp:SqlDataSource>
                </ContentTemplate>
            </asp:UpdatePanel>
            <br />
            <asp:UpdatePanel ID="OrderDetailsPanel" UpdateMode="Conditional" runat="server">
                <ContentTemplate>
                    <asp:GridView ID="GridView2" runat="server" BackColor="White" BorderColor="#E7E7FF"
                        BorderStyle="None" BorderWidth="1px" Caption="訂貨明細資料" CellPadding="3" DataKeyNames="訂單號碼,產(chǎn)品編號"
                        DataSourceID="SqlDataSource2" GridLines="Horizontal" Width="608px" AllowSorting="True">
                        <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
                        <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
                        <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
                        <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
                        <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
                        <AlternatingRowStyle BackColor="#F7F7F7" />
                        <EmptyDataTemplate>
                            <b><i>請您從以上的清單中選取一筆訂單.....</i></b>
                        </EmptyDataTemplate>
                        <EmptyDataRowStyle BackColor="#404040" ForeColor="Red" />
                    </asp:GridView>
                    <br />
                    <asp:SqlDataSource ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:chtNorthwind %>"
                        SelectCommand="SELECT 訂單號碼,產(chǎn)品編號,單價,數(shù)量,折扣 FROM dbo.訂貨明細 WHERE (訂單號碼 = @OrderID)"
                        runat="server">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="GridView1" Name="OrderID" PropertyName="SelectedValue"
                                Type="Int32" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="SelectedIndexChanged" />
                    <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="PageIndexChanged" />
                    <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="Sorted" />
                </Triggers>
            </asp:UpdatePanel>

    本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多