如果页面中有jquery-ui.js引用,则dopostback不起作用 [英] dopostback is not working if there is a jquery-ui.js reference in a page

查看:97
本文介绍了如果页面中有jquery-ui.js引用,则dopostback不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义多选控件我尝试关闭它,如果用户在选择项目并强制回发触发onchange事件后点击页面上的其他位置。只要页面上没有jquery引用,它就可以正常工作。我有一个helpcontrol,其中添加了两个jquery引用来显示工具提示然后dopostback无效。

这是我的代码,

 < span class =code-keyword> private   static   string  doPostBackWhenDropdownCloses( string  clientId, string  divID, string  postBackHiddenField)
{
string strScript = $(文档).click(function(){ +
debugger; +
if(document.getElementById(' + postBackHiddenField +。 value == ' 1'){ +
document.getElementById( ' + postBackHiddenField +')。 value = ' 0'; +
$(' #+ divID +')。hide(function(){ +
javascript:__ doPostBack(' + clientId +'' '); +
}); +
} +
}); ;
返回strScript;
}

解决方案

(文档).click(function(){ +
debugger; +
if(document.getElementById(' + postBackHiddenField +。 value == ' 1'){ +
document.getElementById (' + postBackHiddenField +')。 value = ' 0'; +


' #+ divID +')。hide(function(){ +
javascript:__ doPostBack(' + clientId +'' '); +
}); +
} +
}); ;
返回strScript;
}


I have a custom multiselect control am trying to close it if user clicks else where on a page after selecting the items and forcing a postback to trigger onchange event of it. it works as expected as long as there are no jquery references on a page. I have a helpcontrol where am addding two jquery references to show a tooltip then dopostback is not working.
Here is my code,

private static string doPostBackWhenDropdownCloses(string clientId, string divID, string postBackHiddenField)
{
   string strScript = "$(document).click(function() {" +
                      "debugger;"+
                      "if(document.getElementById('" + postBackHiddenField + .value=='1') {" +
                      " document.getElementById('" + postBackHiddenField + "').value='0';" +
                      "   $('#" + divID + "').hide( function(){" +
                      "   javascript: __doPostBack('" + clientId + "',''); " +
                      "   });" +
                        "}" +
                       "});";
   return strScript;
}

解决方案

(document).click(function() {" + "debugger;"+ "if(document.getElementById('" + postBackHiddenField + .value=='1') {" + " document.getElementById('" + postBackHiddenField + "').value='0';" + "


('#" + divID + "').hide( function(){" + " javascript: __doPostBack('" + clientId + "',''); " + " });" + "}" + "});"; return strScript; }


这篇关于如果页面中有jquery-ui.js引用,则dopostback不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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