简体   繁体   English

避免在gridview事件上回发

[英]Avoid postback on gridview event

1 1个

I've got popup (using javascript) working in a kind of gridview. 我已经在某种gridview中使用了弹出式窗口(使用javascript)。 When you click a button on one grid, it displays a popup window containing another grid of information, based on the row clicked in the first grid. 当您单击一个网格上的按钮时,它将根据第一个网格中单击的行显示一个包含另一个信息网格的弹出窗口。

This works well... I've enabled editing in the grid that is popped up. 效果很好...我已经启用了在弹出的网格中进行编辑的功能。 When you click edit though, the popup window disappears. 当您单击“编辑”时,弹出窗口消失。 If I click the display button in the first grid though to bring the popup window visible again it displays, and is now in edit mode. 如果我在第一个网格中单击显示按钮以再次使弹出窗口可见,它将显示,并且现在处于编辑模式。

Is there a way to make postbacks in the popup not close the popup? 有没有办法使弹出窗口中的回发不关闭弹出窗口?

Hidden variable is way to go. 隐藏变量是要走的路。

<input id="popupState" type="hidden" value="1"  runat="server"/>

Set it from javascript and make the popup visible or invisible based on hidden variable's value in 从javascript进行设置,并根据中隐藏变量的值使弹出窗口可见或不可见

jQuery(document).ready(function($) {
  // your code goes here.
});

if you are using jQuery or if you are using Microsoft Ajax controls ie script manager etc. 如果您使用的是jQuery,或者您使用的是Microsoft Ajax控件,例如脚本管理器等。

function pageLoad(sender, e)
{
 //your code goes here
}

both of the javascript methods fires once the page is loaded on client. 页面加载到客户端后,两种javascript方法均会触发。 Better if you use jQuery one. 如果使用jQuery one更好。

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

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