主题:[原创]gridview问题
teddylee
[专家分:20] 发布于 2007-10-13 10:59:00
点击已经建立好的gridview中的一行,在另一个gridview中显示该行的详细信息,怎么弄啊?
回复列表 (共1个回复)
沙发
artor112 [专家分:10] 发布于 2007-11-16 17:09:00
我给你提供代码~~自己看~~没有数据库~
<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>
我来回复