C# 为什么';system.web.ui.scriptmanager';不包含';registerpostbackcontrol';?

C# 为什么';system.web.ui.scriptmanager';不包含';registerpostbackcontrol';?,c#,asp.net,C#,Asp.net,选项卡面板内的下载按钮不起作用。。我尝试这种方法: ImageButton lb = e.Row.FindControl("ImageButton1") as ImageButton; if(lb != null) ScriptManager.RegisterPostbackControl(lb); int index = ((GridViewRow)((ImageButton)e.CommandArgument).

选项卡面板内的下载按钮不起作用。。我尝试这种方法:

  ImageButton lb = e.Row.FindControl("ImageButton1") as ImageButton;  
            if(lb != null)
            ScriptManager.RegisterPostbackControl(lb);
            int index = ((GridViewRow)((ImageButton)e.CommandArgument).Parent.Parent).RowIndex;

但为什么它说“system.web.ui.scriptmanager”不包含“registerpostbackcontrol”的定义呢?我已经在页眉上使用system.web.ui。。。请帮助

您必须将
System.Web.Extensions.dll
引用添加到您的项目中

如果您已经这样做了,并且问题仍然存在,请确保页面中的
ScriptManager
控件没有ID
ScriptManager
,因为C#将尝试使用它而不是类