回 帖 发 新 帖 刷新版面

主题:[原创]gridview问题

点击已经建立好的gridview中的一行,在另一个gridview中显示该行的详细信息,怎么弄啊?

回复列表 (共1个回复)

沙发


  我给你提供代码~~自己看~~没有数据库~
<body bgcolor="#c9e7e9">
    <form id="form1" runat="server">
    <div style="font: normal normal normal 100% '0_UKKA Tuz Qara';width:16%;float:left;padding-right:5px;">
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AutoGenerateColumns="False" CellPadding="4" DataKeyNames="timahy" 
            DataSourceID="AccessDataSource1" ForeColor="#333333" GridLines="None" 
            PageSize="25" ShowHeader="False">
            <footerstyle backcolor="#990000" font-bold="True" forecolor="White" />
            <rowstyle backcolor="#FFFBD6" forecolor="#333333" />
            <Columns>
                <asp:boundfield DataField="timahy" HeaderText="timahy" SortExpression="timahy">
                </asp:boundfield>
                <asp:commandfield ButtonType="Image" SelectImageUrl="~/images/ARW05RT.ICO" 
                    SelectText="内容" ShowSelectButton="True"></asp:commandfield>
            </Columns>
            <pagerstyle backcolor="#FFCC66" forecolor="#333333" horizontalalign="Center" />
            <selectedrowstyle backcolor="#FFCC66" font-bold="True" forecolor="Navy" />
            <headerstyle backcolor="#990000" font-bold="True" forecolor="White" />
            <alternatingrowstyle backcolor="White" />
        </asp:GridView>
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
            DataFile="~/App_Data/data.mdb" SelectCommand="SELECT [timahy] FROM [tima]"></asp:AccessDataSource>
    </div>
    <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
        CellPadding="4" DataSourceID="AccessDataSource2" Font-Names="0_UKKA Tuz Qara" 
        ForeColor="#333333" GridLines="None" PageSize="25" ShowHeader="False">
        <footerstyle backcolor="#990000" font-bold="True" font-names="0_UKKA Tuz Qara" 
            forecolor="White" />
        <rowstyle backcolor="#FFFBD6" forecolor="#333333" />
        <Columns>
            <asp:boundfield DataField="hanyu" HeaderText="hanyu" SortExpression="hanyu">
            </asp:boundfield>
            <asp:boundfield DataField="wpinying" HeaderText="wpinying" 
                SortExpression="wpinying"></asp:boundfield>
            <asp:boundfield DataField="weiyu" HeaderText="weiyu" SortExpression="weiyu">
            </asp:boundfield>
            <asp:boundfield DataField="wyuying" HeaderText="wyuying" 
                SortExpression="wyuying"></asp:boundfield>
        </Columns>
        <pagerstyle backcolor="#FFCC66" forecolor="#333333" horizontalalign="Center" />
        <selectedrowstyle backcolor="#FFCC66" font-bold="True" forecolor="Navy" />
        <headerstyle backcolor="#990000" font-bold="True" forecolor="White" />
        <alternatingrowstyle backcolor="White" />
    </asp:GridView>
    <asp:AccessDataSource ID="AccessDataSource2" runat="server" 
        DataFile="~/App_Data/data.mdb" 
        SelectCommand="SELECT [hanyu], [wpinying], [weiyu], [wyuying], [timahy] FROM [mazmun] WHERE ([timahy] = ?)">
        <SelectParameters>
            <asp:controlparameter ControlID="GridView1" Name="timahy" 
                PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
    </asp:AccessDataSource>
    <br />
    <br />
</form>

我来回复

您尚未登录,请登录后再回复。点此登录或注册