Asp.net ';ASP.default_aspx';不包含';DS#U过滤&x27;没有扩展方法

Asp.net ';ASP.default_aspx';不包含';DS#U过滤&x27;没有扩展方法,asp.net,Asp.net,在default.aspx上启用SqlDataSourcefiltering事件后,出现以下错误 “ASP.default\u aspx”不包含 “DS_筛选”和“否”的定义 扩展方法 我遗漏了什么吗 请帮助以下内容可能会让您了解这是如何工作的,请检查: <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>ASP.NET Example</ti

在default.aspx上启用
SqlDataSource
filtering事件后,出现以下错误

“ASP.default\u aspx”不包含 “DS_筛选”和“否”的定义 扩展方法

我遗漏了什么吗


请帮助

以下内容可能会让您了解这是如何工作的,请检查:

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
        <form id="FORM1" runat="server">

            <p>Show all employees with the following title:
            <asp:DropDownList
                id="DropDownList1"
                runat="server"
                AutoPostBack="True">
                <asp:ListItem>Sales Representative</asp:ListItem>
                <asp:ListItem>Sales Manager</asp:ListItem>
                <asp:ListItem>Vice President, Sales</asp:ListItem>
            </asp:DropDownList></p>

            <asp:SqlDataSource
                id="SqlDataSource1"
                runat="server"
                ConnectionString="<%$ ConnectionStrings:NorthwindConnection %>"
                SelectCommand="SELECT EmployeeID,FirstName,LastName,Title FROM Employees"
                FilterExpression="Title='{0}'" OnFiltering="SqlDataSource1_Filtering">
                <FilterParameters>
                    <asp:ControlParameter Name="Title" ControlId="DropDownList1" PropertyName="SelectedValue"/>
                </FilterParameters>
            </asp:SqlDataSource><br />

            <asp:GridView
                id="GridView1"
                runat="server"
                DataSourceID="SqlDataSource1"
                AutoGenerateColumns="False">
                <columns>
                    <asp:BoundField Visible="False" DataField="EmployeeID" />
                    <asp:BoundField HeaderText="First Name" DataField="FirstName" />
                    <asp:BoundField HeaderText="Last Name" DataField="LastName" />
                </columns>
            </asp:GridView>
                <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

        </form>
    </body>
</html> 

你可以发布你到目前为止尝试过的代码吗?请发布你的表单设计。我想替换SqlDataSource1.FilterExpression上的撇号。我尝试了此SqlDataSource1.FilterExpression.Replace(“{0}”,e.ParameterValues[0].ToString().Replace(“”,“”);但不起作用。请在页面上使用FilterExpression,如:SqlDataSource1.FilterExpression=“city=”+DropDownList1.SelectedValue.ToString().Replace(“”,“,”;+”);不起作用。我需要有%text%,其中文本包含引号。在应用之前,请使用text=text。替换(“,”)。
  protected void SqlDataSource1_Filtering(object sender, SqlDataSourceFilteringEventArgs e)
    {
        Label1.Text = e.ParameterValues[0].ToString();
    }