我有一个下拉列表,其中包含项目代码,当我从该下拉列表中选择项目代码时,我的其他下拉列表应显示与项目代码对应的财务年度... [英] i have a dropdown list which contains projectcode and when i should select projectcode from that dropdownlist my other dropdownlist should show financial years corresponding to the projectcode...

查看:68
本文介绍了我有一个下拉列表,其中包含项目代码,当我从该下拉列表中选择项目代码时,我的其他下拉列表应显示与项目代码对应的财务年度...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

dropdowlist1包含项目代码

dropdownlist2包含财务年度,但应该根据我在dropdownlist1中选择的项目代码

dropdowlist1 contains project code
dropdownlist2 contains financial year but it should be according to the project code i have selected in dropdownlist1

推荐答案

我给你一个类似的解决方案。只需根据你的要求改变它....



更改连接字符串,查询,DataTextField,DataValueField ..那就是......



Hi, i''m giving u a similar soln., just change this according to ur requirements....

Change connection string, query, DataTextField, DataValueField... that''s all...

<div>
       <asp:UpdatePanel ID="UpdatePanel2" runat="server">
       <ContentTemplate>
           <asp:DropDownList ID="DropDownList2" runat="server"

               DataSourceID="SqlDataSource2" DataTextField="make"

               DataValueField="id" AutoPostBack="True">
           </asp:DropDownList>
           <asp:SqlDataSource ID="SqlDataSource2" runat="server"

               ConnectionString="<%


ConnectionStrings:TestDbConnectionString %> <跨度class =code-attribute>

SelectCommand = SELECT * FROM [Manufacturer] > < / asp:SqlDataSource >
< br / >
< asp:DropDownList ID = < span class =code-keyword> DropDownList1 runat = server

DataSourceID = SqlDataSource1 DataTextField = product_name

DataValueField = product_id >
< / asp:DropDownList >
< asp:SqlDataSource ID = SqlDataSource1 runat = server

< span class =code-attribute> ConnectionString = <%
ConnectionStrings:TestDbConnectionString %>" SelectCommand="SELECT * FROM [Manufacturer]"></asp:SqlDataSource> <br /> <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1" DataTextField="product_name" DataValueField="product_id"> </asp:DropDownList> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%


ConnectionStrings:TestDbConnectionString %>

SelectCommand = SELECT [product_id],[product_name] FROM [product] WHERE([mid] = @mid) >
< SelectParameters < span class =code-keyword>>
< asp:ControlParameter ControlID = DropDownList2 名称 = < span class =code-keyword> mid

< span class =code-attribute> < span class =code-attribute> PropertyName = SelectedValue 类型 = Int32 < span class =code-attribute> / >
< / SelectParameters >
< / asp:SqlDataSource >
< / ContentTemplate >
< / asp:UpdatePanel >
< / div >
ConnectionStrings:TestDbConnectionString %>" SelectCommand="SELECT [product_id], [product_name] FROM [product] WHERE ([mid] = @mid)"> <SelectParameters> <asp:ControlParameter ControlID="DropDownList2" Name="mid" PropertyName="SelectedValue" Type="Int32" /> </SelectParameters> </asp:SqlDataSource> </ContentTemplate> </asp:UpdatePanel> </div>





如果你有任何澄清回复,...

如果你发现这个有用的话请标记它......


这篇关于我有一个下拉列表,其中包含项目代码,当我从该下拉列表中选择项目代码时,我的其他下拉列表应显示与项目代码对应的财务年度...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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