如何将两个表数据查看到一个gridview中..... [英] how to view two table datas into one gridview.....
本文介绍了如何将两个表数据查看到一个gridview中.....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两张评级表:
表1:
id
名称
date
文件
主题
主题
文章
表2评级:
id
评价
这是我的代码:
i have Two table for rating:
Table 1:
id
Name
date
Files
Topic
Subject
article
Table 2 for rating:
id
Rate
This is my code:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" PageSize="4" AutoGenerateColumns="False"
BackColor="White" BorderColor="#CCCCCC" BorderStyle="Ridge" BorderWidth="2px"
CellPadding="3" DataKeyNames="ReplyDoubtID" DataSourceID="SqlDataSource1" OnRowCommand="GridView1_RowCommand"
CssClass="roundedbox" CellSpacing="1" GridLines="None">
<Columns>
<asp:BoundField DataField="Name" HeaderText="Sender Name" SortExpression="Name" />
<asp:BoundField DataField="Subject" HeaderText="Subject" SortExpression="Subject" />
<asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
<asp:TemplateField HeaderText="Topic">
<ItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Topic") %>' TextMode="MultiLine"
Height="54px" Width="202px" CssClass="roundedbox"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Solved Doubts">
<ItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("ReplyDoubt") %>' TextMode="MultiLine"
Height="84px" Width="239px" CssClass="roundedbox"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Download">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%# Eval("Files") %>'
Text='<%# Eval("Files") %>' CommandName="Download" OnClick="LinkButton1_Click"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Rate">
<ItemTemplate>
<cc1:Rating ID="Rating1" runat="server" StarCssClass="Star" WaitingStarCssClass="WaitingStar"
EmptyStarCssClass="Star" FilledStarCssClass="FilledStar" Height="22px" Width="107px"
AutoPostBack="True" OnChanged="OnRatingChanged" BehaviorID="Rating1_RatingExtender">
</cc1:Rating>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="White" ForeColor="#000066" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#007DBB" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#00547E" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:VCRConnectionString %>"
SelectCommand="SELECT * FROM [ReplyDoubt]" FilterExpression="Topic LIKE '%{0}%'">
<FilterParameters>
<asp:ControlParameter Name="Topic" ControlID="TextBox3" PropertyName="Text" />
</FilterParameters>
</asp:SqlDataSource>
</asp:Content>
所以我想显示评级,但我有一个sqldatasource连接请帮帮我
是否可能......
So i want to show the rating,but i have one sqldatasource connection please help me
is it possible......
推荐答案
ConnectionStrings:VCRConnectionString %>
SelectCommand = SELECT * FROM [ReplyDoubt] FilterExpression = < span class =code-keyword>主题LIKE'%{0}%' >
< FilterParameters >
< asp:ControlParameter 名称 = 主题 ControlID = TextBox3 < span class =code-attribute> PropertyName = 文字 / >
< ; / FilterParameters >
< / asp:SqlDataSource >
< / asp:Content >
ConnectionStrings:VCRConnectionString %>" SelectCommand="SELECT * FROM [ReplyDoubt]" FilterExpression="Topic LIKE '%{0}%'"> <FilterParameters> <asp:ControlParameter Name="Topic" ControlID="TextBox3" PropertyName="Text" /> </FilterParameters> </asp:SqlDataSource> </asp:Content>
So i want to show the rating,but i have one sqldatasource connection please help me
is it possible.... ..
So i want to show the rating,but i have one sqldatasource connection please help me
is it possible......
Can you join the content of table 1 to table 2? If not, it may not make sense to show data for these two tables together.
Can you join the content of table 1 to table 2? If not, it may not make sense to show data for these two tables together.
这篇关于如何将两个表数据查看到一个gridview中.....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文