下面的代码在上传到 IIS 时导致错误(在本地开发机器上运行得很好)
<PagerTemplate>
<asp:Table runat="server" Width="100%">
<asp:TableRow>
<asp:TableCell HorizontalAlign="Left">
<asp:PlaceHolder ID="ph" runat="server"></asp:PlaceHolder>
</asp:TableCell>
<asp:TableCell HorizontalAlign="Right" Width="10%">
Page Size
<asp:DropDownList runat="server" ID="ddlPageSize" AutoPostBack="true"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
<asp:ListItem>10</asp:ListItem>
<asp:ListItem>20</asp:ListItem>
<asp:ListItem>50</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
</asp:DropDownList>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</PagerTemplate>
编译错误 描述:在编译服务此请求所需的资源期间发生错误。请查看以下特定错误详细信息并适当修改您的源代码。
编译器错误消息: CS1061:“ASP.default_aspx”不包含“ddlPageSize_SelectedIndexChanged”的定义,并且找不到接受“ASP.default_aspx”类型的第一个参数的扩展方法“ddlPageSize_SelectedIndexChanged”(您是否缺少 using 指令或装配参考?)
Line 113: <asp:TableCell HorizontalAlign="Right" Width="10%">
Line 114: Page Size
Line 115: <asp:DropDownList runat="server" ID="ddlPageSize" AutoPostBack="true"
Line 116: OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
Line 117: <asp:ListItem>10</asp:ListItem>
这没有任何意义,因为我的ddlPageSize_SelectedIndexChanged
代码隐藏文件中确实有该方法:
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlPageSize = (gvRecordsList.BottomPagerRow).FindControl("ddlPageSize") as DropDownList;
gvRecordsList.PageSize = int.Parse(ddlPageSize.SelectedValue);
}
有谁知道这可能是什么?