Solved

How to use AJAX toolkit script manager with user controls

Posted on 2009-06-29
1
4,834 Views
Last Modified: 2012-05-07
I am getting the error "System.InvalidOperationException: Only one instance of a ScriptManager can be added to the page." I know the error is because I have toolkitscriptmanager on the page, but i need it there. I don't know where the other declaration for a scriptmanager is??

<%@ Control Language="C#" AutoEventWireup="true" ClassName="uc_ORItem" CodeFile="uc_ORItem.ascx.cs"
    Inherits="uc_ORItem" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<style type="text/css">
    td
    {
        font-family: Tahoma;
        font-size: 12px;
    }
    .textbox
    {
        font-family: Tahoma;
        font-size: 12px;
    }
</style>
<table cellpadding="0" cellspacing="0" border="0">
    <tr>
        <td valign="middle">
            <cc1:ToolkitScriptManager EnableScriptLocalization="true" ID="ToolkitScriptManager1" runat="server">
            </cc1:ToolkitScriptManager>
            SubSet:<asp:TextBox ID="tbSubset" CssClass="textbox" runat="server" TextMode="SingleLine"
                AutoPostBack="false"></asp:TextBox>
            <!--<asp:HiddenField ID="hdSubSet" runat="server" />-->
            <asp:HiddenField ID="hdSubSetTime" runat="server" />
            <cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="tbSubset"
                BehaviorID="AutoCompleteEx" ServicePath="Web_Services/LookupSubSet.asmx" ServiceMethod="Get_Subset_List"
                UseContextKey="true" ContextKey="SubSet" MinimumPrefixLength="1" CompletionInterval="1000"
                EnableCaching="true" CompletionSetCount="20" DelimiterCharacters=";, :" OnClientItemSelected="itemSelected"
                CompletionListCssClass="completion_list">
            </cc1:AutoCompleteExtender>
            <%-- Prevent enter in textbox from causing the collapsible panel from operating --%>
 
            <script type="text/javascript">
            // Work around browser behavior of "auto-submitting" simple forms
            var frm = document.getElementById("aspnetForm");
 
            if (frm) 
            {
                frm.onsubmit = function() { return false; };
            }
                                            
            function itemSelected(source, eventArgs)
            {
                //alert("key: " + eventArgs.get_text() + "  value: " + eventArgs.get_value());
                //document.all["hdSubset"].value = eventArgs.get_text();
                document.all["hdSubSetTime"].value = eventArgs.get_value();
                //__doPostBack('hidButton','AutoCompleteItemSelected'); 
                document.forms[0].hidButton.click();
            }
            </script>
 
            <input type="submit" id="hidButton" style="display: none;" />
            &nbsp; Set:<asp:TextBox ID="tbSet" runat="server" CssClass="textbox"></asp:TextBox>
            &nbsp;Quantity:<asp:TextBox ID="tbQuantity2" runat="server" CssClass="textbox" AutoPostBack="true"
                Width="50px"></asp:TextBox>
            &nbsp;MEPRS:<asp:TextBox ID="tbTotal2" runat="server" CssClass="textbox" Width="50px"></asp:TextBox>
            <asp:ImageButton ID="ibtDeleteItems" runat="server" ImageUrl="~/Images/delete.gif"
                AlternateText="Delete Item" OnClick="ibtDeleted_Clicked" />
        </td>
    </tr>
</table>

Open in new window

0
Comment
Question by:mjoseph23
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
mjoseph23 earned 0 total points
ID: 24739413
Found the scriptmanager on the page creating the control. Removed from there.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
array not updating 8 41
c# ftp code 3 55
asp.net repeater 2 33
C#:  Need to switch between timer loop and token driven loop 2 28
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question