以下代码在上传到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'的定义,并且没有扩展方法'ddlPageSize_SelectedIndexChanged'接受'ASP.default_aspx'类型的第一个参数可能是发现(您是否缺少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);
}
任何人都知道这可能是什么?