html 代码
我在使用ScriptManager 控件的时候,想局部刷新的,但是没有成功, 而且头部的上面 会多一行这样的代码,如果没有它ScriptManager 控件就会报错 。我新建了一个项目用同样的代码和控件,但是没有头部这一行 ,费解啊!!!<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div class="spgm_4left">
<asp:DropDownList ID="sizedrop" runat="server" Width="150px" AutoPostBack="true"
onselectedindexchanged="sizedrop_SelectedIndexChanged" >
</asp:DropDownList>
<asp:DropDownList ID="colordrop" runat="server"
Width="150px">
</asp:DropDownList>
</div>
</ContentTemplate></asp:UpdatePanel>
cs代码protected void sizedrop_SelectedIndexChanged(object sender, EventArgs e)
{
ListItem li2 = new ListItem();
li2.Text = "请选择颜色";
li2.Value = "请选择颜色";
this.colordrop.Items.Add(li2);
}
我在使用ScriptManager 控件的时候,想局部刷新的,但是没有成功, 而且头部的上面 会多一行这样的代码,如果没有它ScriptManager 控件就会报错 。我新建了一个项目用同样的代码和控件,但是没有头部这一行 ,费解啊!!!<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div class="spgm_4left">
<asp:DropDownList ID="sizedrop" runat="server" Width="150px" AutoPostBack="true"
onselectedindexchanged="sizedrop_SelectedIndexChanged" >
</asp:DropDownList>
<asp:DropDownList ID="colordrop" runat="server"
Width="150px">
</asp:DropDownList>
</div>
</ContentTemplate></asp:UpdatePanel>
cs代码protected void sizedrop_SelectedIndexChanged(object sender, EventArgs e)
{
ListItem li2 = new ListItem();
li2.Text = "请选择颜色";
li2.Value = "请选择颜色";
this.colordrop.Items.Add(li2);
}
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>是必须的,而且要放在UpdatePanel上面。
我重新开了一个新建了项目 在用ScriptManager 这个控件的时候 这一行就不会出现 而且局部刷新成功了
<pages validateRequest="false">
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></controls></pages>
<compilation debug="true">
<assemblies>
<add assembly="System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></controls></pages>这里的呢?有么?
<controls>
<add tagPrefix="MsgBox" namespace="TreeControls" assembly="TreeControls"/>
<add tagPrefix="Super" namespace="SuperControl" assembly="SuperControl"/>
</controls>
你把新项目里面的web.config改改放到你原来项目里面去试试