Click here to Skip to main content
16,015,351 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
History of problem
The code that is working was created in it on separated project with Visual Studio 2010. The Ajax dll was AJAX Control Toolkit — December 2013 Release. The file was downloaded from http://www.asp.net/ajaxlibrary/act.ashx[^]. The scriptmanager that was available from this file was ToolkitScriptManager. This code was copy over into a existing project.

History on existing problem project:

This project was updated from Visual Studio 2008 to Visual Studio 2010. The project has two AJAX Folders which or label Ajax Ver 3.5 and AJAX ver 4.0. Also, the project is using the ScriptManager and not ToolkitScriptManager. The ScriptManager is added to the MasterPage. When I copy the code from working project into the project I remove the ToolkitScriptManager which I was using in the project and used the existing project ScriptManager which is in the old application. Everything seem to be working until attempted to grab the value from the dropdownlist. The value being return were the default value and not the value being selected from the list. I am not sure if the upgrade of the application from Visual Studio 2008 and Visual Studio 2010 is the problem. I am not sure with of the Ajax folder (3.5 and 4.0) or being used.

I setup the MasterPage in the working aspx page to identical code in the master page inwhich the code is working.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Can anyone tell me why in the program that it is giving me a problem has the file asp.designer.aspx. Some of the solution have mention somethings about the AjaxControlToolKit is missing for the control within the *.aspx.designer.aspx file. Can you give me some detail on what may be needed in the *.aspx.designer.aspx. These are only simple aspx dropdown control.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
I have attempt several things and the dropdown are not working properly. I created two version of the project. The sample project to test out the code is working. But, when I move the code over into a existing project the problem starts. Could there be somethings that is needed in the designer code.

The dropdown that are giving the error could I see them in the Designer of the code. Again, I think the error are coming from the dropdown. In the designer code I see protected global::System.Web.UI.WebControls.DropDownList ddlList; should it be something different because it is within the Update and Panel control.

Old additional information
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
I have the three dropdownlist inside the update panel in my aspx page.But till it is giving the postbacks.Please help me in solving the issue.

State when working:
It work with the below ToolkitScriptManager in the ASP.NET Form that has the drop down. Also, the drop down work properly when you add the ToolkitScriptManager to the MasterPage which is associated with the form

<asp:ToolkitScriptManager ID="tsm" runat="server">


State when the problem start.
The problem start when I add the following Scriptmanager in form or MasterPage

<asp:ScriptManager ID="sm" runat="server" ScriptMode="Release" >


Line: 524
Error: Unable to get value of the property 'UI': object is null or undefined. When I am not getting that error, I can see the item that is select but can not see it in the watch. It is showing the default value which is the SelectValue of 0 and SelectItem.Text of {Select Item}

Thank in advance if anyone can come up with the solution to this problem. I have attempted several things.
Posted
Updated 22-Jan-15 9:18am
v5
Comments
sudevsu 16-Jan-15 16:05pm    
Can you share the code to understand it better?

Quote:
1. First you have to add AjaxControlToolkit.dll in your project references.
2. Add

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

in your page directory.

3. add script manager to your aspx page

XML
<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>



4. In Last add below code in update panel.


XML
<asp:UpdatePanel ID="pnlupdate" runat="server">
            <ContentTemplate>
            <asp:DropDownList ID="ddlList" runat="server" AutoPostBack="true">
            <asp:ListItem Text = "--Select--" Value="--Select--"></asp:ListItem>
            <asp:ListItem Text = "laptop" Value="laptop"></asp:ListItem>
            <asp:ListItem Text = "Mobile" Value="Mobile"></asp:ListItem>
            </asp:DropDownList>
            </ContentTemplate>
</asp:UpdatePanel>
 
Share this answer
 
v4
Comments
Member 11227881 20-Jan-15 9:00am    
First of all thanks for responsing to my question. I want to give you more detail of the problem. The code that is working was build in a different project. I am using the AjaxControlToolkit.Binary.Net40. I followed all four step that you have suggested. The different is with step 3. In step 3. I am using the ScriptManager below:

<asp:ToolkitScriptManager ID="tsm" runat="server">


I also tested the code with the

<asp:ScriptManager ID="ScriptManager1" runat="server">


The block of code still works with the script manager that you suggested.

Here is when the problem starts:
When I move this code to another project which has a Masterpage with the scriptManager within the project the dropdown stop working. The drop down populate properly. When you look at the code in the watch you see the code is pointing at
asp:ListItem Text = "--Select--" Value="--Select--">

What every you select on the dropdown you still see the above selection. The project is using the AJAX Toolkit40
Member 11227881 20-Jan-15 9:32am    
Correction to the earlier statement. I see my code only work with the

<asp:ToolkitScriptManager ID="tsm" runat="server">


Does this mean that I need to rewrite the code from scratch using the from the 4.0

<asp:ScriptManager ID="ScriptManager1" runat="server">
Member 11227881 20-Jan-15 10:20am    
When I change the scriptmanager from <asp:ToolkitScriptManager ID="tsm" runat="server"> to the <asp:ScriptManager ID="ScriptManager1" runat="server">

I get the below error with the modalpopup.


Error: Unable to get value of the property 'UI': object is null or undefined
Member 11227881 20-Jan-15 14:00pm    
The dropdown that are giving the error could I see them in the Designer of the code. Again, I think the error are coming from the dropdown. In the designer code I see protected global::System.Web.UI.WebControls.DropDownList ddlList; should it be something different because it is within the Update and Panel control.
Greetings:

I have come up with a solution. I simply removed the UpdatePanel from the from around the code that is in container of the masterpage. I wish to thank everyone who replied to my problem.

Referred to the below for the answer:

http://forums.asp.net/t/1608556.aspx?Error+Two+components+with+the+same+id+can+t+be+added+to+the+application[^]



XML
<asp:UpdatePanel ID="up" runat="server" UpdateMode="Conditional" BackColor="#C0FFC0"
           CssClass="panel">
               <ContentTemplate>
 
Share this answer
 
v3
XML
Greetings:

I have come up with a solution. I simply removed the UpdatePanel from the from around the code that is in container of the masterpage. I wish to thank everyone who replied to my problem.

Referred to the below for the answer:

<a href="http://forums.asp.net/t/1608556.aspx?Error+Two+components+with+the+same+id+can+t+be+added+to+the+application">http://forums.asp.net/t/1608556.aspx?Error+Two+components+with+the+same+id+can+t+be+added+to+the+application</a>[<a href="http://forums.asp.net/t/1608556.aspx?Error+Two+components+with+the+same+id+can+t+be+added+to+the+application" target="_blank" title="New Window">^</a>]



<pre lang="xml">&lt;asp:UpdatePanel ID=&quot;up&quot; runat=&quot;server&quot; UpdateMode=&quot;Conditional&quot; BackColor=&quot;#C0FFC0&quot;
           CssClass=&quot;panel&quot;&gt;
               &lt;ContentTemplate&gt;</pre>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900