【发布时间】:2013-09-25 15:56:36
【问题描述】:
我在让它工作时遇到了很多问题,所以我的页面上有 2 个下拉菜单,还有一个我想先隐藏。在第二个下拉列表(任何选择)中进行选择后,我希望第三个下拉列表及其标签变得可见。它们都连接到数据库。我以一种简单的方式重新创建了代码的这一方面以提供视觉效果。 我已经在网上搜索了帮助。我是 .NET 的新手,从未使用过 jquery 或 ajax,如果可能的话,我只希望在 C# 中使用它。如果您建议 jquery,请更详细地解释。在这一点上,CS 页面几乎是空的。任何帮助表示赞赏。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Dropdowns</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="ddlManu" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource1" DataTextField="Field1" DataValueField="ID" >
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
SelectCommand="SELECT [Version] FROM [ProductVersion]"
DataSourceMode="DataReader">
</asp:SqlDataSource>
<asp:DropDownList ID="ddlProduct" runat="server"
DataSourceID="SqlDataSource2" DataTextField="Field1" DataValueField="ID"
AutoPostBack="True" >
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString2.ProviderName %>"
SelectCommand="SELECT [ID], [Field1], [Field2],[FKID] FROM [MSProducts]
WHERE FKID = @ID" DataSourceMode="DataReader">
<SelectParameters>
<asp:ControlParameter ControlID="ddlManu" Name="ID"
PropertyName="SelectedValue" DefaultValue="" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<asp:Label ID="Label1" runat="server" Text="Category1:"></asp:Label>
<asp:DropDownList ID="ddlPop" runat="server" DataSourceID="SqlDataSource1">
</asp:DropDownList>
<br />
<br />
<br />
<br />
<br />
<br />
</form>
</body>
</html>
【问题讨论】:
标签: c# javascript html asp.net .net