请帮我解决这个问题 [英] please help me to solve this issue

查看:69
本文介绍了请帮我解决这个问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在网页中有一个Dropdownlist,Detailview,GridView.
在下拉列表中,我显示所有发票编号.
Gridview必须显示与下拉列表选择的发票编号相关的项目详细信息.
(我已经使用foreignkey完成了gridview -发票号是外键)
Detailview必须显示与下拉列表选择的发票编号相关的公司详细信息.
我无法做到这一点
下拉列表显示的是来自物料表的发票
detailsview字段来自Customerdetails表
这两个控件的外键是CusId.

你能帮忙吗

谢谢

Hi

I have a Dropdownlist,Detailview,GridView in a webpage.
In Dropdownlist i am displaying all invoice number.
Gridview has to display itemdetails related to Dropdownlist selected invoice number.
(i have done gridview using foreignkey-- invoicenumber is foreign key)
Detailview has to display the company details related to Dropdownlist selected invoice number.
i am not able to do this pls help
Dropdownlist is displaying the invoiceno it is from Item Table
detailsview fields are from Customerdetails table
foreignkey for this two control is CusId.

could you please help

Thanks

推荐答案

我也尝试过使用CS代码进行相同操作
因为这是我第一个无法理解的项目.
请帮助

下拉列表

Hi I tried the same by using cs code also
since this is my first project not able to understand this.
please help

Dropdownlist

 <asp:dropdownlist id="doddl" datasourceid="sds1" runat="server" autopostback="True" appenddatabounditems="True" xmlns:asp="#unknown">
                        DataTextField="DoNumber" DataValueField="DoNumber" Width="250px" OnSelectedIndexChanged="doddl_SelectedIndexChanged">
                    
                     
                
                <td align="right"><asp:sqldatasource id="sds1" runat="server" xmlns:asp="#unknown">
                        ConnectionString="<%


ConnectionStrings:InvoiceConnectionString %>" SelectCommand="SELECT [DoNumber] FROM [ItemParent]"> </td>
ConnectionStrings:InvoiceConnectionString %>" SelectCommand="SELECT [DoNumber] FROM [ItemParent]"> </td>



详细视图



Detail view

 <asp:detailsview id="DetailsView1" datasourceid="sds2" runat="server" height="50px" width="492px" autogeneraterows="False" xmlns:asp="#unknown">
                        BackColor="White" GridLines="None" Visible="False" BorderColor="#336666" BorderStyle="Solid"
                        BorderWidth="1px" CellPadding="4">
                        <footerstyle backcolor="#FFFFCC" forecolor="#330099" />
                        <rowstyle backcolor="White" forecolor="#330099" />
                        <fields>
                            <asp:boundfield datafield="CompName" headertext="CompName">
                                SortExpression="CompName">
                            
                            <asp:boundfield datafield="CompAdd" headertext="CompAdd">
                                SortExpression="CompAdd" />
                            <asp:boundfield datafield="Tel" headertext="Tel" sortexpression="Tel" />
                            <asp:boundfield datafield="Fax" headertext="Fax" sortexpression="Fax" />
                            <asp:boundfield datafield="ContPerson" headertext="ContPerson">
                                SortExpression="ContPerson" />
                            <asp:boundfield datafield="SalesPerson" headertext="SalesPerson">
                                SortExpression="SalesPerson" />
                        </fields>
                        <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
                        <editrowstyle backcolor="#FFCC66" font-bold="True" forecolor="#663399" />
                    
                    
                                   
            
            <tr>
            <td>
            <asp:sqldatasource id="sds2" runat="server" xmlns:asp="#unknown">
                    ConnectionString="<%


ConnectionStrings:InvoiceConnectionString %>" SelectCommand="SELECT CompName, CompAdd, Tel, Fax, ContPerson, SalesPerson FROM CustomerDetails WHERE (CusId = @CusId)"> <SelectParameters> <asp:sessionparameter name="CusId" sessionfield="CusId"> Type="String" /> </SelectParameters> </td></tr>
ConnectionStrings:InvoiceConnectionString %>" SelectCommand="SELECT CompName, CompAdd, Tel, Fax, ContPerson, SalesPerson FROM CustomerDetails WHERE (CusId = @CusId)"> <SelectParameters> <asp:sessionparameter name="CusId" sessionfield="CusId"> Type="String" /> </SelectParameters> </td></tr>



网格视图



Grid view

<asp:GridView ID="PrintGv" DataSourceID="sds3" runat="server" BorderWidth="1px" GridLines="None" AutoGenerateColumns="False"

                        CellPadding="4" ForeColor="#333333" Width="849px" BorderColor="#336666"

                        BorderStyle="Solid" Visible="False">
                        <Columns>
                            <asp:BoundField DataField="ItemNo" HeaderText="ItemNo" SortExpression="ItemNo">
                                <FooterStyle HorizontalAlign="Center" />
                                <HeaderStyle HorizontalAlign="Left" Width="20px" VerticalAlign="Top" BackColor="#FF99FF"

                                    BorderStyle="Solid" BorderWidth="1px" />
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description">
                                <HeaderStyle HorizontalAlign="Left" VerticalAlign="Top" BackColor="#FF99FF" BorderStyle="Solid"

                                    BorderWidth="1px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="Qty" HeaderText="Qty" SortExpression="Qty">
                                <HeaderStyle HorizontalAlign="Left" Width="10px" VerticalAlign="Top" BackColor="#FF99FF"

                                    BorderStyle="Solid" BorderWidth="1px" />
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:BoundField>
                        </Columns>
                    </asp:GridView>
                    <asp:SqlDataSource ID="sds3" runat="server"

                        ConnectionString="<%


这篇关于请帮我解决这个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆