Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

I have the grid in the updatepanel. When I select the row the popup panel show with the correct dropdown selection in the text. I do not see the correct value in the Watch window. The DropDownList show me the value of "None in the SelectedValue and {Select Day}in the SelectedItem. The actual Value of the SelectedValue should be "1" and the SelectedItem should be {Monday}. I can select any item in the list and I get the same thing of "None" in the SelectValue and {Select Day} in the SelectedItem. The "None" and {Select Day} or the first items in the list. I attempted to use the findcontrol and see the same problem of "None" and {Select Day}. The Dropdown list is load with a source file.

More Details Below:
Dropdown List is not update when added to MasterPage. My Dropdown list is with in a panel of Updatepanel. I have a grid within a updatepanel. The grid has edit link that launches a panel that has a dropdown list. I base my code on this example below:

Popup Editing/Adding/Deleting Records with GridView[^]

Everything was working properly until the code was added to the masterpage. The scriptmanager was added to the masterpage. I attempted the solution below but still not able get the actual value on the list. When doing a watch, I see the default of index 0 and not the actual value that is showing. I can select any items in the list and it does not show in the watch.

Suggestion did not work:
If your dropdown is in the update panel then the dropdown selectedIndex will not fire until you used Update panel trigger.

<triggers>
<asp:asyncpostbacktrigger controlid="DropDownList1" eventname="SelectedIndexChanged" xmlns:asp="#unknown" />

Posted
Updated 16-Jan-15 9:35am
v6
Comments
Afzaal Ahmad Zeeshan 14-Jan-15 15:44pm    
What?
Member 11227881 14-Jan-15 17:30pm    
I am trying to reference it from the panel within a updatepanel.
Member 11227881 14-Jan-15 17:31pm    
It is not on the masterpage?
Member 11227881 14-Jan-15 17:36pm    
It was working outside of the masterpage. When I place updatepanel with the panel that has the dropdown into the master page it stop working. I can see the text selection. But, when I do a watch I see default value of zero and the text of { Make Select }

1 solution

Are you trying to view the values from the perspective of the content page's context or master page's context?

If the code and controls reside on the master page and you want to access them from the content page, you will need to access them by first getting a reference to the controls first.

C#
DropDownList masterDropDownList = this.Master.FindControl("DropDownList1") as DropDownList;


Hope this helps.
 
Share this answer
 
Comments
Member 11227881 14-Jan-15 18:11pm    
I have the grid in the updatepanel. When I select the row the popup panel show with the correct select in the text. I do not see the correct value in the Watch window. The DropDownList show me the value of "None in the SelectedValue and {Select Day}in the SelectedItem. The actual Value of the SelectedValue should be "1" and the SelectedItem should be {Monday}. I can select any item in the list and I get the same thing of "None" in the SelectValue and {Select Day} in the SelectedItem. The None and Select Day or the first items in the list.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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