简体   繁体   English

Modalpopup无法在ASP.NET AJAX中正常工作

[英]Modalpopup not working properly asp.net ajax

I have an updatepanel,a modal popup extender inside that and an image button to open the pop up(it has not any click event). 我有一个updatepanel,里面有一个模式弹出扩展程序,还有一个图像按钮来打开弹出窗口(它没有任何单击事件)。 The 'div' for the modal pop up is outside the updatepanel. 模态弹出窗口的“ div”在updatepanel之外。 In the modal pop up the records come in a table with a link in each table row.When the link is clicked,a javascript function causes a hidden control to postback and fetch values from database.First time it is working fine,but next time the image button(TargetControlID for modal pop up extender) does not work and it is causing a postback and loading the page.Help plz... Thanks in advance. 在模式弹出框中,记录进入一个表,每个表行中都有一个链接。单击链接时,一个javascript函数使一个隐藏的控件回发并从数据库中获取值。第一次运行良好,但是下次图像按钮(用于模式弹出扩展程序的TargetControlID)不起作用,并导致回发并加载页面。请帮助...谢谢。 Mohak 莫哈克

Are you using myLink.ClientID or did you hardcoded the ID of the link in the Javascript function? 您正在使用myLink.ClientID还是在Javascript函数中对链接的ID进行了硬编码?

The ID of the link is probably changed when doing the first postback, the second time ASP.NET has generated a new ID (not visible in the HTML because of the AJAX-request) for your link and this doesn't match anymore with the ID in your Javascript function. 第一次执行回发时,链接的ID可能会更改,第二次ASP.NET为您的链接生成新的ID(由于AJAX请求,因此在HTML中不可见),而该ID不再与您的Javascript函数中的ID。

The solution would be to use myLink.ClientID 解决方案是使用myLink.ClientID

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM