Click here to Skip to main content
15,890,365 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I was able to select dropdown value inside of modalpopup. But, when I added the form to a masterpage and move the scriptmanager to the Masterpage. The below events started happening


Modal popup is inside the update panel. I have a dropdown control inside modal popup. When i select the data in the dropdown and click ok on the modal popup it always shows the dropdown selectedvalue as first index no matter what i select . I am not able to find the solution for this.


The problem started when I added the code to a existing master page which has the following scriptmanager.

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


Here are the steps
1. The modual popup is launch from the Grid linkEdit. The module popup is within a panel. The Grid is outside of the panel within the Update Panel that surrounds everything.

Step 2. I load the dropdown list within the Preload with a

if (!IsPostBack)
{
The dropdown are load here.
}

3. When the modal popup is visible the dropdown has the correct value. But when you set a watch you see the default value of {Please Select}. Then I attempt to select a different value and you see {Please Select}. You see the same thing within the OnSelectedIndexChanged.

Note:
I have this code within a MasterPage. There is Update panel around the everything. Within there is simply a panel around the dropdown links. I can see the label content but the only content that I see on the dropdown is the default selection. But, what is displayed is correct. When I try to make a change to the selection. I still get the default setting. This work before it was added to the masterpage.

Sample Code Layout
<asp:UpdatePanel ID="UpdatePanel1" runat="server"> <contenttemplate>

<asp:Panel ID="Panel1" runat="server">

<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"> <asp:ListItem>Red
<asp:ListItem>Green <asp:ListItem>Blue

<Triggers>

<asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName="SelectedIndexChanged" /> </Triggers>


I am using the following in the application that is working.
<%-- <asp:ToolkitScriptManager ID="tsm" runat="server">
--%>

The one with the masterpage that is not working is using the following
<asp:ScriptManager ID="ScriptManagerRAMS" runat="server" ScriptMode="Release" >


I tried using the one below and get a error message Parser Error Message: Unknown server tag 'asp:ToolkitScriptManager'.


<%-- <asp:ToolkitScriptManager ID="tsm" runat="server">
Posted
Updated 13-Jan-15 10:08am
v6
Comments
ZurdoDev 12-Jan-15 16:03pm    
Click Improve question and post the relevant code.
BillWoodruff 12-Jan-15 19:43pm    
Please add more detail: is this a Web based project, or WPF ? ... or ?
Member 11227881 13-Jan-15 10:43am    
<asp:UpdatePanel ID="UpdatePanel1" runat="server"> <contenttemplate> <asp:Panel ID="Panel1" runat="server"> <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"> <asp:ListItem>Red <asp:ListItem>Green <asp:ListItem>Blue <Triggers> <asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName="SelectedIndexChanged" /> </Triggers>
Member 11227881 13-Jan-15 10:43am    
I have this code within a MasterPage. There is Update panel around the everything. Within there is simply a panel around the dropdown links. I can see the label content but the only content that I see on the dropdown is the default selection. But, what is displayed is correct. When I try to may a change to the selection. I still get the default setting. I have attempted what you said. Again within the updated panel you have a grid that has a link that calls the popup and the popup in within simple a panel. This work before it was added to the masterpage.
Member 11227881 13-Jan-15 10:58am    
The problem started when I added the code to a existing master page which has the following scriptmanager.

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


Here are the steps
1. The modual popup is launch from the Grid linkEdit. The module popup is within a panel. The Grid is outside of the panel within the Update Panel that surrounds everything.

Step 2. I load the dropdown list within the Preload with a

if (!IsPostBack)
{
The dropdown are load here.
}

3. When the modal popup is visible the dropdown has the correct value. But when you set a watch you see the default value of {Please Select}. Then I attempt to select a different value and you see {Please Select}. You see the same thing within the OnSelectedIndexChanged.

I am using the following in the application that is working.
<%-- <asp:ToolkitScriptManager ID="tsm" runat="server">
--%>

The one with the masterpage that is not working is using the following
<asp:ScriptManager ID="ScriptManagerRAMS" runat="server" ScriptMode="Release" >


I tried using the one below and get a error message Parser Error Message: Unknown server tag 'asp:ToolkitScriptManager'.


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

1 solution

If your dropdown is in the update panel then the dropdown selectedIndex will not fire until you used Update panel trigger.
A sample code is attached. try to make it. if still have problem. post the code.

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


Use this trigger inside of your update panel Modal popup.

write your dropdownName in the control ID and then use the selectedIndex.
 
Share this answer
 
Comments
Member 11227881 13-Jan-15 9:42am    
I have this code within a MasterPage. There is Update panel around the everything. Within there is simply a panel around the dropdown links. I can see the label content but the only content that I see on the dropdown is the default selection. But, what is displayed is correct. When I try to may a change to the selection. I still get the default setting. I have attempted what you said. Again within the updated panel you have a grid that has a link that calls the popup and the popup in within simple a panel. This work before it was added to the masterpage.
Member 11227881 13-Jan-15 10:43am    
<asp:UpdatePanel ID="UpdatePanel1" runat="server"> <contenttemplate> <asp:Panel ID="Panel1" runat="server"> <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"> <asp:ListItem>Red <asp:ListItem>Green <asp:ListItem>Blue <Triggers> <asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName="SelectedIndexChanged" /> </Triggers>
Member 11227881 13-Jan-15 10:58am    
The problem started when I added the code to a existing master page which has the following scriptmanager.

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


Here are the steps
1. The modual popup is launch from the Grid linkEdit. The module popup is within a panel. The Grid is outside of the panel within the Update Panel that surrounds everything.

Step 2. I load the dropdown list within the Preload with a

if (!IsPostBack)
{
The dropdown are load here.
}

3. When the modal popup is visible the dropdown has the correct value. But when you set a watch you see the default value of {Please Select}. Then I attempt to select a different value and you see {Please Select}. You see the same thing within the OnSelectedIndexChanged.

I am using the following in the application that is working.
<%-- <asp:ToolkitScriptManager ID="tsm" runat="server">
--%>

The one with the masterpage that is not working is using the following
<asp:ScriptManager ID="ScriptManagerRAMS" runat="server" ScriptMode="Release" >


I tried using the one below and get a error message Parser Error Message: Unknown server tag 'asp:ToolkitScriptManager'.


<%-- <asp:ToolkitScriptManager ID="tsm" runat="server">
Member 11227881 13-Jan-15 16:08pm    
I am using the following in the application that is working.
<%-- <asp:ToolkitScriptManager ID="tsm" runat="server">
--%>

The one with the masterpage that is not working is using the following
<asp:ScriptManager ID="ScriptManagerRAMS" runat="server" ScriptMode="Release" >


I tried using the one below and get a error message Parser Error Message: Unknown server tag 'asp:ToolkitScriptManager'.


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

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

  Print Answers RSS


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