3

"Only one instance of a ScriptManager can be added to the page." this error appear when I added the script Manager to the password strength of AJAX toolkit.

i added the password strength beside the password field of my createuserwizard. why this error would appear when this is the only scriptmanager that i had in my website?

here is the code:

 <asp:TextBox runat="server" ID="Password" TextMode="Password" MaxLength="20" />
<asp:ScriptManager ID="ScriptManager2" runat="server">
</asp:ScriptManager>
 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate> 
 <asp:PasswordStrength ID="Password_PasswordStrength" runat="server" 
                                Enabled="True" TargetControlID="Password"   DisplayPosition="RightSide"
                             StrengthIndicatorType="BarIndicator"
                              BarBorderCssClass="barBorder"
                               BarIndicatorCssClass="barInternal">
                         </asp:PasswordStrength>

                            <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator10" ControlToValidate="Password" 
                                ErrorMessage="Password is required." />   
      </ContentTemplate> </asp:UpdatePanel> 
                        </td>
                    </tr>
Artem Koshelev
  • 10,548
  • 4
  • 36
  • 68
user1467175
  • 277
  • 4
  • 9
  • 16
  • Why is it called `ScriptManager2` if it's only one? :) Don't you have ToolkitScriptManager already? http://stackoverflow.com/q/1996095/55209 – Artem Koshelev Jun 22 '12 at 11:04
  • nope, it was actually ScriptManager1, i change it to ScriptManager2 to try whether the code will run. But end up, the same error appeared. – user1467175 Jun 22 '12 at 11:13
  • Check the page and it's masterpage (if any) for `asp:ToolkitScriptManager` element – Artem Koshelev Jun 22 '12 at 11:15

2 Answers2

5

Just remove this ScriptManager and it will work fine.

<asp:ScriptManager ID="ScriptManager2" runat="server">
</asp:ScriptManager>

You have definitely added a ScriptManager somewhere else in your Page or MasterPage.

ScriptManager Control Overview

Only one instance of the ScriptManager control can be added to the page. The page can include the control directly, or indirectly inside a nested component such as a user control, content page for a master page, or nested master page. If a page already contains a ScriptManager control, but a nested or parent component needs additional features of the ScriptManager control, the component can include a ScriptManagerProxy control. For example, the ScriptManagerProxy control enables you to add scripts and services that are specific to nested components.

nunespascal
  • 17,584
  • 2
  • 43
  • 46
3

Maybe your Masterpage has a Scriptmanager too? Check your whole aspx page hierarchy...

DerApe
  • 3,097
  • 2
  • 35
  • 55