无法访问modalpopup中的下拉列表值 [英] Not able to access dropdown value inside modalpopup

查看:65
本文介绍了无法访问modalpopup中的下拉列表值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够在modalpopup中选择下拉值。但是,当我将表单添加到母版页并将脚本管理器移动到母版页时。以下事件开始发生





模态弹出窗口位于更新面板内。我在模态弹出窗口中有一个下拉控件。当我在下拉列表中选择数据并在模态弹出窗口中单击确定时,无论我选择什么,它总是将下拉选择值显示为第一个索引。我无法找到解决方案。





当我将代码添加到现有母版页时,问题就出现了以下脚本管理器。



< asp:ScriptManager

ID =ScriptManagerRAMS

runat =server

ScriptMode =发布>





以下是步骤

1.模块弹出窗口是从Grid linkEdit启动的。模块弹出窗口在面板中。 Grid位于更新面板中围绕所有内容的面板之外。



步骤2.我使用
$ b加载Preload中的下拉列表$ b

if(!IsPostBack)

{

下拉列表在这里加载。

}



3.当模态弹出窗口可见时,下拉列表具有正确的值。但是当您设置手表时,您会看到{Please Select}的默认值。然后我尝试选择不同的值,您会看到{请选择}。你在OnSelectedIndexChanged中看到同样的东西。



注意:

我在MasterPage中有这个代码。所有内容都有更新面板。在下拉链接周围只有一个面板。我可以看到标签内容,但我在下拉列表中看到的唯一内容是默认选择。但是,显示的内容是正确的。当我尝试更改选择时。我仍然得到默认设置。这项工作在添加到母版页之前。



示例代码布局

< asp:UpdatePanel ID =UpdatePanel1runat =服务器> <&的ContentTemplate GT;



< asp:Panel ID =Panel1runat =server>



< asp:DropDownList ID =DropDownList1runat =serverAutoPostBack =trueOnSelectedIndexChanged =DropDownList1_SelectedIndexChanged> < asp:ListItem>红色

< asp:ListItem>绿色< asp:ListItem>蓝色



<触发器>



< asp:AsyncPostBackTrigger ControlID =DropDownList1EventName =SelectedIndexChanged/> < / Triggers>





我在正在运行的应用程序中使用以下内容。

<% - < asp:ToolkitScriptManager ID =tsmrunat =server>

- %>



主页不能正常使用以下内容

< asp:ScriptManager ID =ScriptManagerRAMSrunat =serverScriptMode =Release >





我尝试使用下面的一个并收到错误消息解析器错误消息:未知的服务器标签'asp:ToolkitScriptManager'。





<% - < asp:ToolkitScriptManager ID =tsmrunat =server>

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">

推荐答案

如果您的下拉列表位于更新面板中,则在您使用更新面板触发器之前,下拉列表selectedIndex将不会触发。

附加示例代码。试着去做。如果还有问题。发布代码。



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.

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





在更新面板Modal弹出窗口中使用此触发器。



在控件ID中写下你的dropdownName,然后使用selectedIndex。



Use this trigger inside of your update panel Modal popup.

write your dropdownName in the control ID and then use the selectedIndex.


这篇关于无法访问modalpopup中的下拉列表值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆