单击按钮后显示特定的确认消息

编程入门 行业动态 更新时间:2024-10-11 07:35:52
本文介绍了单击按钮后显示特定的确认消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在表中有一个数据网格,并且在数据网格的每一行中都有一个超链接,该超链接允许用户导航到某个页面或停留在当前页面.另一方面,我的超链接在sql请求中执行计数",如果sql请求返回的数字大于15,则将您导航到第二页,否则,将其导航到10至15之间确认消息(如果单击确定",则将导航到另一页,否则将停留在当前页面),否则将显示一条消息,表明您无法导航到另一页.

Hi, i have a datagrid in my table and in each row of the datagrid i have an hyperlink that allows a user to either naviguate to a certain page or stay in the current page. in other hand, my hyperlink do a "Count" in sql request, and if the number returned of the sql request is superior to 15, it navigates you to a second page, else if it''s between 10 to 15, it shows you a confirm message (if you click "ok" then you will navigate to the other page, else you will stay in the current page), else it shows you a message that shows you that you can''t navigate to the other page.

推荐答案

solution1很好,在这里我向您解释如何在页面方法后面添加代码并在javascript中使用它: 这是您的代码背后: the solution1 is good and here I explain to you how to add to your code behind a page method and use it in javascript: here is your code behind: [WebMethod] [ScriptMethod] public static int getSqlCountAjax() { //write your code here for this method }

然后使用脚本管理器并启用pagemethod属性:

then use script manager and enable pagemethod property:

function validateLink() { PageMethods.getSqlCountAjax(onRequestComplete, onError); // call to yr AJAX function to get sql count function onRequestComplete(result) { var sqlCount = result; if (sqlCount > 15) { return true; } else if (sqlCount >= 10 || sqlCount <= 15) { if (confirm('yr confirmation mesaage here...') == 1) { return true; } } else { alert('not allowed to navigate to this page'); return false; } return false; } }

单击此处 剧本 函数validateLink(){ var sqlCount = getSqlCountAjax(); //调用yr AJAX函数以获取sql count if(sqlCount> 15){ 返回true; } 否则if(sqlCount> = 10 || sqlCount< = 15){ if(confirm(''yr确认消息在这里...'')== 1){ 返回true; } } 其他{ alert(``不允许导航到此页面''); 返回false; } } 问候 尼拉·索尼(Nial Soni) click here Script function validateLink() { var sqlCount = getSqlCountAjax(); // call to yr AJAX function to get sql count if(sqlCount >15) { return true; } else if(sqlCount >= 10 || sqlCount <=15) { if( confirm(''yr confirmation mesaage here...'') == 1) { return true; } } else { alert(''not allowed to navigate to this page''); return false; } } Regards Niral Soni

更多推荐

单击按钮后显示特定的确认消息

本文发布于:2023-11-11 05:24:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1577499.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单击   按钮   消息

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!