我在 VB 中有一个 Visual Studio 2010 asp.net 页面,我在其中加入了多个表,SqlDataSource
以在 gridview 中显示特定列。表连接后,我有一个下拉列表,我希望它只显示那些“SKillGroup”列值等于下拉列表中所选项目的行。但是,在运行页面时,下拉列表中只有一个在列表中重复的选定项目(该项目是硬件)。
我的问题是如何使下拉列表显示“硬件”“软件”和“网络”的所有三个项目,并根据所选搜索将其填充到网格视图中?
这是我的下拉列表和网格视图代码
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
DataSourceID="ProblemDataSource" DataTextField="SkillGroup"
DataValueField="SkillGroup">
<asp:ListItem Selected="True">Hardware</asp:ListItem>
<asp:ListItem Selected="True">Software</asp:ListItem>
<asp:ListItem Selected="True">Network</asp:ListItem>
</asp:DropDownList>
<asp:GridView ID="ProblemGridView" runat="server" AutoGenerateColumns="False"
DataSourceID="ProblemDataSource" style="margin-top: 0px"
AllowPaging="True">
<Columns>
<asp:BoundField DataField="ProblemID" HeaderText="ProblemID"
SortExpression="ProblemID" />
<asp:BoundField DataField="CustomerID" HeaderText="CustomerID"
SortExpression="CustomerID" />
<asp:BoundField DataField="Summary" HeaderText="Summary"
SortExpression="Summary" />
<asp:BoundField DataField="DateLogged" HeaderText="DateLogged"
SortExpression="DateLogged" />
<asp:BoundField DataField="DateUpdated" HeaderText="DateUpdated"
SortExpression="DateUpdated" />
<asp:BoundField DataField="Status" HeaderText="Status"
SortExpression="Status" />
<asp:BoundField DataField="Priority" HeaderText="Priority"
SortExpression="Priority" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="Surname" HeaderText="Surname"
SortExpression="Surname" />
<asp:BoundField DataField="SkillGroupID" HeaderText="SkillGroupID"
SortExpression="SkillGroupID" />
<asp:BoundField DataField="SkillGroup" HeaderText="SkillGroup"
SortExpression="SkillGroup" />
<asp:BoundField DataField="Expr1" HeaderText="Expr1" SortExpression="Expr1" />
<asp:BoundField DataField="Expr2" HeaderText="Expr2" SortExpression="Expr2" />
<asp:BoundField DataField="NoteID" HeaderText="NoteID"
SortExpression="NoteID" />
<asp:BoundField DataField="ResolutionID" HeaderText="ResolutionID"
SortExpression="ResolutionID" />
</Columns>
</asp:GridView>
这是我SqlDataSource
的表格加入和过滤技能组列的下拉列表
<asp:SqlDataSource ID="ProblemDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT p.ProblemID, p.CustomerID, p.Summary, p.DateLogged, p.DateUpdated, s.Status, pr.Priority, t.Name, t.Surname, sg.SkillGroupID, sg.SkillGroup, ho.Name AS Expr1, ho.Surname AS Expr2, p.NoteID, p.ResolutionID FROM Problem AS p LEFT OUTER JOIN Status AS s ON p.StatusID = s.StatusID INNER JOIN HelpdeskOperator AS ho ON p.HelpdeskID = ho.HelpdeskID LEFT OUTER JOIN Priority AS pr ON p.PriorityID = pr.PriorityID LEFT OUTER JOIN [Skill Group] AS sg ON p.SkillGroupID = sg.SkillGroupID INNER JOIN Technician AS t ON p.ProblemID = t.ProblemID AND s.StatusID = t.StatusID AND pr.PriorityID = t.PriorityID WHERE ([SkillGroup] = @SkillGroup) "
<FilterParameters>
<asp:Parameter Name="newparameter" />
</FilterParameters>
<InsertParameters>
<asp:Parameter Name="SkillGroup" />
</InsertParameters>
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="SkillGroup"
PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
我还发布了一个指向屏幕截图的链接,显示了下面的问题
http://helios.hud.ac.uk/u0356716/Helpdesk.html
有人可以给我建议,因为它已经困扰了我一段时间。
先感谢您