【发布时间】:2014-08-12 14:13:15
【问题描述】:
尝试添加 SelectParameter 并选择下拉菜单。页面没有失败,但没有过滤掉类名 - 不接受参数 @ClassName 隶属关系参数工作正常,但 @ClassName 没有!
WHERE ClassName = @ClassName
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="AccessDataSource1" BackColor="White" BorderColor="#999999"
BorderStyle="Solid" BorderWidth="1px" CellPadding="3" ForeColor="Black"
GridLines="Vertical" AllowSorting="True">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="RowLevelCheckBox" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="UsersDataTbl.StudentID" HeaderText="FDID" SortExpression="StudentID" />
<asp:BoundField DataField="UsersDataTbl.LastName" HeaderText="Last Name" SortExpression="LastName" />
<asp:BoundField DataField="UsersDataTbl.FirstName" HeaderText="First Name" SortExpression="FirstName" />
<asp:BoundField DataField="UsersDataTbl.UserName" HeaderText="User Name" SortExpression="UserName" />
<asp:BoundField DataField="UsersDataTbl.Affiliation" HeaderText="Affiliation" SortExpression="Affiliation" />
<asp:BoundField DataField="UsersDataTbl.UID" HeaderText="UID" SortExpression="UID" />
</Columns>
<FooterStyle BackColor="#CCCCCC" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#6699CC" />
</asp:GridView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="<%$ ConnectionStrings:AccessSubSiteString %>"
SelectCommand="SELECT [UsersDataTbl.StudentID], [UsersDataTbl.UserName],
[UsersDataTbl.LastName], [UsersDataTbl.FirstName], [UsersDataTbl.Affiliation], [UsersDataTbl.UID]
FROM [UsersDataTbl] WHERE [UsersDataTbl.Active] = True AND (UsersDataTbl.Affiliation = @Affiliation)
AND ([UsersDataTbl.UID] NOT IN (SELECT UID FROM [EnrollmentsTbl] WHERE ClassName = @ClassName AND Completed = True))
ORDER BY [UsersDataTbl.LastName]" >
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList2" Name="Affiliation" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="DropDownList1" Name="ClassName" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:AccessDataSource>
【问题讨论】:
标签: asp.net gridview drop-down-menu filter