Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/478.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
更新面板中的按钮不会从javascript触发_Javascript_Asp.net_Ajax - Fatal编程技术网

更新面板中的按钮不会从javascript触发

更新面板中的按钮不会从javascript触发,javascript,asp.net,ajax,Javascript,Asp.net,Ajax,如果调用了该函数,并且按钮位于更新面板内,则不会触发(尽管直接单击该按钮可以工作)-将其放置在更新面板外,脚本即可工作 有什么想法吗 <div> <asp:UpdatePanel ID="UpdatePanel2" runat="server"> <ContentTemplate> <asp:Button ID="GridViewLBClicked" runat="server" /> </Conten

如果调用了该函数,并且按钮位于更新面板内,则不会触发(尽管直接单击该按钮可以工作)-将其放置在更新面板外,脚本即可工作

有什么想法吗

<div>

<asp:UpdatePanel ID="UpdatePanel2" runat="server">
    <ContentTemplate>
      <asp:Button ID="GridViewLBClicked" runat="server"   />
       </ContentTemplate>
   <%-- 
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="GridViewLBClicked" EventName="Click" />
    </Triggers>--%>
</asp:UpdatePanel>

    </div>

 <script>
     function RaiseEvent_Click() {
         document.getElementById('<%=GridViewLBClicked.ClientID%>').click();
         alert('It was clicked');
    }

</script>

函数RaiseEvent_Click(){
document.getElementById(“”)。单击();
警报(“它已被单击”);
}
雷乔斯

我怀疑是其他加载的javascript导致了这个问题,因为我以前也用过同样的方法——下面是另一个加载的脚本

function LinkButtonClick(){alert('This was clicked');uu doPostBack('contentplaceholder 1_GridViewLBClicked','')}var sessionTimeoutWarning='18';var sessionTimeout='20';var timeOnPageLoad=新日期();var sessionWarningTimer=null;var redirectTowerComePageTimer=null;var sessionWarningTimer=setTimeout('SessionWarning()',parseInt(sessionTimeoutWarning)*60*1000);var redirectToWelcomePageTimer=setTimeout('RedirectToWelcomePage()',parseInt(sessionTimeout)*60*1000);函数SessionWarning(){var minutesForExpiry=(parseInt(sessionTimeout)-parseInt(sessionTimeoutWarning));var message='您的会话将在另一个'+minutesForExpiry+'分钟后过期。是否要扩展会话?';$('#SessionModal').modal('show');var currentTime=new Date();var timeForExpiry=timeOnPageLoad.setMinutes(timeOnPageLoad.getMinutes()+parseInt(sessionTimeout));if(Date.parse(currentTime)>timeForExpiry){window.location='http://localhost:53818/Logout_Landing/SessionEnded“;}}函数重定向TowerComePage(){window.location=”http://localhost:53818/Logout_Landing/SessionEnded“;}$(document).ready(function(){var divWidth=document.getElementById('imageHeader').clientWidth;var imagePadding=75;var imageOneWidth=document.getElementById('TopImage_1').width;var imageTwoWidth=document.getElementById('TopImage_2').width;var imageThreeWidth=document.getElementById('TopImage_3').width;var imageFourWidth=document.getElementById('TopImage_4')).width;var-imageFiveWidth=document.getElementById('TopImage_5')。width;var-totalImageWidth=imagePadding+imageOneWidth+imageTwoWidth+imageThreeWidth+imageFourWidth+imageFiveWidth;var-widthDifference=divWidth-totalImageWidth;var-percentDifference=Math.round(宽度差/Div;var imageOne=document.getElementById('TopImage_1');var imageTwo=document.getElementById('TopImage_2');var imageTwo=document.getElementById('TopImage_3');var imageFour=document.getElementById('TopImage_5');var currentHeight=imageOne.height;imageOne.style.height=Math.round(currentHeight+(currentHeight/100*percentDifference))+“px”imageTwo.style.height=Math.round(currentHeight+(currentHeight/100*percentDifference))+“px”imageThree.style.height=Math.round(currentHeight+(currentHeight/100*percentDifference))+“px”imageThree.style.height=Math.round(currentHeight+(currentHeight/100*percentDifference))+“px”;imageFive.style.height=Math.round(currentHeight+(currentHeight/100*percentDifference))+“px”});window.onresize=function(){var divWidth=document.getElementById('imageHeader').clientWidth;var imagePadding=75;var imageOneWidth=document.getElementById('TopImage_1')).width;var imageTwoWidth=document.getElementById('TopImage_2')。width;var imageThreeWidth=document.getElementById('TopImage_3')。width;var imageFourWidth=document.getElementById('TopImage_4')。width;var imageFiveWidth=document.getElementById('TopImage_5')).width;var totalImageWidth=imagePadding+imageOneWidth+imageTwoWidth+imageThreeWidth+imageFourWidth+imageFiveWidth;var widthDifference=divWidth-totalImageWidth;var percentDifference=Math.round(widthDifference/divWidth*100);var imageOne=document.getElementById('TopImage_1');var imageTwo=document('TopImage_2');var imageThree=document.getElementById('TopImage_3');var imageFour=document.getElementById('TopImage_4');var imageFive=document.getElementById('TopImage_5');var currentHeight=imageOne.height;imageOne.style.height=Math.round(currentHeight+(currentHeight/100*percentDifference))+“px”;imageTwo.style.height=Math.round(currentHeight+(currentHeight/100*percentDifference))+“px”imageThree.style.height=Math.round(currentHeight+(currentHeight/100*percentDifference))+“px”imageThree.style.height=Math.round(currentHeight+(currentHeight/100*percentDifference))+“px”imageFive.style.height=Math.round(currentHeight+(currentHeight/100*percentDifference))+“px”};$(document).ready(函数(){$('body').append(@media(最大宽度:1025px){.navbar标题{float:none;}.navbar left、.navbar right{float:none!重要;}.navbar切换{display:block;}.navbar折叠{边框顶部:1px实心透明;方框阴影:插入0 1px 0 rgba(255255255,0.1);}.navbar固定顶部{top:0;边框宽度:0 0 1px;}.navbar-collapse.collapse{display:none!important;}.navbar导航{float:none!important;页边距顶部:7.5px;}.navbar导航>li{float:none;}.navbar导航>li>a{padding top:10px;padding bottom:10px;}.collapse.in{display:block!important;}.navbar-collapse.in{overflow-y:auto!important;}.navbar-nav.open.dropdown菜单{position:static;float:none;width:auto;margin top:0;背景色:透明;边框:0;方框阴影:none;}.navbar nav.open.dropdown menu>li>a.navbar nav.open.dropdown menu.dropdown header{padding:5px 15px 5px 25px;}.navbar inverse.navbar nav.open.dropdown menu>li>a{color:#999;}.navbar inverse.navbar nav.open.dropdown menu>li>a:hover.navbar inverse{color:#fff;背景色:透明;背景图像:无;}”
function RaiseEvent_Click() {
     __doPostBack('<%=GridViewLBClicked.UniqueID%>', '');
     alert('It was clicked');
}
<input type="button" id="btnClickMe" value="Click me" />
<asp:UpdatePanel runat="server" ID="uPanel1">
    <ContentTemplate>
        <asp:TextBox runat="server" ID="txtInside"></asp:TextBox>
        <asp:Button runat="server" ID="btnPostInside" />
    </ContentTemplate>
</asp:UpdatePanel>
<script type="text/javascript">
    $("#btnClickMe").on("click", function() {
        $get("<%=btnPostInside.ClientID %>").click();
    });
</script>