Two components with the Same id can't be added to the application


i have a problem with a slider control in one of my user controls. The user control has a modal popup extender with a slider control.
When i load the page for the first time, everything works great. After a second postback i get the error message shown bellow and the slider control is not turning into the visible textbox.

Message: Sys.InvalidOperationException: Two components with the same id 'TabContainer1_tabParts_Tab1Ctrl_sldQuantity' can't be added to the application.
Line: 4044
Char: 59
Code: 0
URI: http://localhost:59170/ScriptResource.axd?d=3Eg-fQsMWKYsGzpai2d16FzRZyxePoVWg0ZiVzxl0IzKq1Ft9y3T2wENj7O3x_hyqAvmWHH4ztSWl-WP85md5YtGYn_v721mKRQ3_QCPeFk1&t=ffffffffec2d9970

What could be the problem?

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Parts.ascx.cs" Inherits="ADDTest.Parts1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<link rel="Stylesheet" type="text/css" href="Styles/Stylesheet.css" id="style" runat="server" visible="false" />
    <div style="height: 445px; vertical-align: top;" id="divParts">               
        <table width="100%">
            <tr valign="top">
                <td width="25%">
                    <div id="divSearch">
                    <p class="text">Search:</p>
                        <asp:TextBox ID="txtSearch" runat="server" Width="169px" 
                        <asp:DropDownList ID="ddlSearch" Width="91px" Height="22px" runat="server" AutoPostBack="True"
                        onselectedindexchanged="ddlSearch_SelectedIndexChanged" >
                            <asp:ListItem selected="True">Description</asp:ListItem>
                            <asp:ListItem>Part ID</asp:ListItem>
                            <asp:ListItem>Bin Loc.</asp:ListItem>
                        <br />
                        <asp:Button ID="btnSearch" runat="server" Text="Search" 
                            onclick="btnSearch_Click" />
                        <asp:Button ID="btnClear" runat="server" Text="Clear" 
                            onclick="btnClear_Click" />
                        <br />
                        <br />
                        <asp:ListBox ID="lbxSearch" runat="server" Height="260px" Width="265px" 
                        <br />
                        <asp:Button ID="btnShow" runat="server" Text="Show Images" 
                        onclick="btnShow_Click" /> 
                        <div id="divSearchBottom">
                            <asp:LinkButton ID="lbtnCheckout" runat="server" PostBackUrl="~/ViewCart.aspx"></asp:LinkButton>
                <td width="75%" valign="top">
                        <asp:DataList ID="DataList1" runat="server"  
                            RepeatColumns="3" RepeatDirection="Horizontal" BackColor="White" 
                            BorderColor="#E26020" BorderStyle="None" BorderWidth="1px" CellPadding="4" 
                            GridLines="Both"  >
                                <FooterStyle BackColor="#99CCCC" ForeColor="#E26020" />
                                <div class="Part">
                                <div class="PartImage">
                                                <asp:Image ID="imgPart" runat="server" Height="50" ImageUrl='<%#"ViewImage.ashx?part=" + Eval("Part") %>' 
                                                    GenerateEmptyAlternateText="true" Width="75" AlternateText="No Image" 
                                                    onmouseover="zoomToggle('100px','100px','200px','200px',this);" />
                                                <asp:Button ID="btnAdd" runat="server" Text="Add to Cart" Height="20px" 
                                                    CommandArgument='<%# Eval("Part") %>' CommandName="Action" onCommand="btnAdd_Command" />    
                                                <cc1:ModalPopupExtender ID="ModalPop" runat="server"
                                                    TargetControlID="btnAdd" PopupControlID="pnlAddPart" 
                                                    CancelControlID="btnPnlCancle" BackgroundCssClass="Modalbackground" 
                                                    DynamicContextKey='<%# Eval("Part") %>' DynamicServiceMethod="PopupMethod" DynamicControlID="txtHidden"  />
                                            <%--<asp:Button ID="btnDetails" runat="server" Text="Details" Height="20px" CommandArgument='<%# Eval("Part") %>' />  --%>
                                    </table> </div>
                                <div class="PartDetails"></div>
                                    <asp:TextBox ID="Parttext" runat="server" ReadOnly="True" TextMode="SingleLine" BorderStyle="None" BorderWidth="0" CssClass="textbox" Text='<%# Eval("Part") %>'></asp:TextBox> 
                                    <br />
                                    <asp:TextBox ID="Desc1Text" runat="server" Rows="2" ReadOnly="True" TextMode="MultiLine" BorderStyle="None" BorderWidth="0" CssClass="textbox" Text='<%# Eval("Desc1") %>'></asp:TextBox>
                                    <br />
                                    Inv: <asp:TextBox ID="InvText" runat="server" ReadOnly="True" TextMode="SingleLine" BorderStyle="None" BorderWidth="0" CssClass="textbox" Text='<%# Eval("Inv") %>' Width="147px"></asp:TextBox>
                                    <br />
                                    BinLoc:<asp:TextBox ID="BinLocText" runat="server" ReadOnly="True" TextMode="SingleLine" BorderStyle="None" BorderWidth="0" CssClass="textbox" Text='<%# Eval("BinLoc") %>' Width="126px"></asp:TextBox>
                                    <br />
                                    Manufacturer: <asp:TextBox ID="ManufacturerText" runat="server" ReadOnly="True" TextMode="SingleLine" BorderStyle="None" BorderWidth="0" CssClass="textbox" Text='<%# Eval("Manufacturer") %>' Width="85px"></asp:TextBox>
                                    <br />
                                <ItemStyle BackColor="White" ForeColor="#E26020" />
                                <SelectedItemStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                                <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
                        <div id="Navigation" class="navigation" runat="server">

                            <div id="leftnav">
                                <asp:Button ID="btnPreviousPage" runat="server" Text="Previous Parts" OnClick="btnPreviousPage_Click" />
                            <div id="rightnav">
                                <asp:Button ID="btnNextPage" runat="server" Text="More Parts"  OnClick="btnNextPage_Click" />
                            <div id="numnav">
                                <asp:Label ID="PagerLocation" runat="server" />
<asp:Panel ID="pnlAddPart" runat="server" style="display:none">

    <asp:ObjectDataSource ID="odsChrgDep" runat="server" 
        OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" 
  <asp:UpdatePanel ID="upAddPart" runat="server" UpdateMode="Always">
        <h1>Select Quantity:</h1>
        <asp:TextBox ID="txtHiddenSlider" runat="server"></asp:TextBox>
        <asp:TextBox ID="txtVisibleSlider" runat="server"></asp:TextBox>
        <cc1:SliderExtender ID="sldQuantity" runat="server" 
            TargetControlID="txtHiddenSlider" BoundControlID="txtVisibleSlider" 
            Maximum="50" Minimum="1" />      
        <asp:RangeValidator ID="RangeValidator1" runat="server" 
            ErrorMessage="RangeValidator" ControlToValidate="txtVisibleSlider" 
            MaximumValue="10" MinimumValue="1" Font-Bold="True" Font-Italic="True" 
            Font-Size="Large" Type="Integer" >Not enough Parts in Stock</asp:RangeValidator>
        <br />
        <h1>Select Charge Department:</h1>
        <asp:DropDownList ID="ddlPnl" runat="server" DataSourceID="odsChrgDep" 
            DataTextField="ChrgDepDesc" DataValueField="ChrgDep" />  
            <br />
        <asp:Button ID="btnPnlOk" runat="server" Text="OK" onClick="btnPnlOk_Click" /> 
        <asp:Button ID="btnPnlCancle" runat="server" Text="Cancle" />
        <asp:TextBox ID="txtHidden" runat="server" style="display:none" />

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

It's only an idea... but maybe your object is still in memory when you make the second call? Maybe if you erase it from memory when the page unloads the problem dissappear.
Sebastian_OHAuthor Commented:
Thanks for the relpy.
How can i unload it ?

I'm not familiar with C#, but I supose that something like "objectToErase = null" at the end of the code should do the trick.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sebastian_OHAuthor Commented:
You pointed me in the right direction.
In my main page i have the User Control show above in an update panel. For some reason that forced the control to be loaded twice. After removed the update panel and placed it in the user control everything works.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.