简体   繁体   English

Microsoft JScript运行时错误:从代码隐藏调用时,将引发对象

[英]Microsoft JScript runtime error: Object expected thrown when called from codebehind

I am using jquery ui tabs and tooltip and it works perfectly.Heres the code for jquery-ui tabs 我正在使用jquery ui选项卡和工具提示,并且效果很好。这里是jquery-ui选项卡的代码

$(function() {
  $( "#tabs" ).tabs();
  $(document).tooltip(); 
});   

I wrote another function which i want to call from code behind on button click event 我写了另一个函数,我想从按钮单击事件后面的代码中调用

function setDiv(type){
    alert(type);         
}

Heres my codebehind function. 这是我的代码隐藏功能。

protected void btnNext_Click(object sender, EventArgs e)
{
    pnlResult.Visible=True;
    ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "script type='text/javascript' language='javascript'",
    "setDiv('highlight')();", true);
}

The problem is when i click the btnNext button ,alert saying highlight is showing.After that i am getting the object expected error on the aspx page and the error points on 问题是当我单击btnNext按钮时,提示说高亮显示。在那之后,我在aspx页面上得到了对象预期的错误 ,并且在错误点上

<div id="tabs-1">(div used for creating tabs)

Here's my aspx page 这是我的aspx页面

<div id="tabs">
    <ul>
        <li><a href="#tabs-1">Nunc tincidunt</a></li>
        <li><a href="#tabs-2">Proin dolor</a></li>
        <li><a href="#tabs-3">Aenean lacinia</a></li>
    </ul>
<div id="tabs-1">//Here's where i am getting the error
    <p>
        <asp:Panel ID="pnlResult" runat="server" Visible="false">
            <div id="divResult"  runat="server">
                <span id="spIcon"   style="float:left;margin-left:3px;"></span>
                Successfully inserted
            </div>
        </asp:Panel>
        <table style="width:50%" id="tbl" runat="server" >
            <tr>
                <td>
                   Your Name:
                </td>
                <td>
                    <input id="name" title="Enter your name here" />
                </td>
            </tr>
            <tr>
                <td >
                    <span class="ui-icon ui-icon-alert"  style="float:left;margin-left:3px;"></span>
                    <input type="button" id="btnSubmit" value="Submit" />
                </td>
            </tr>
        </table>
    </p>
</div>
<div id="tabs-2">
    <p>Tab2.</p>
</div>
<div id="tabs-3">
    <p>Tab3.</p>
    <p>Tab is placed.</p>
</div>
</div>

Your script that you are building in your code behind is malformed, try this: 您在背后的代码中构建的脚本格式错误,请尝试以下操作:

ScriptManager.RegisterClientScriptBlock(
    Page, 
    typeof(Page), 
    "setDiv",
    "<script type='text/javascript'>setDiv('highlight');</script>",
     false);

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

相关问题 jQuery“Microsoft JScript运行时错误:对象预期” - jQuery “Microsoft JScript runtime error: Object expected” Microsoft JScript运行时错误:预期对象 - Microsoft JScript runtime error: Object expected Microsoft JScript运行时错误:“null”为null或不是对象 - Microsoft JScript runtime error: 'null' is null or not an object Microsoft JScript运行时错误:对象不支持此属性或方法 - Microsoft JScript runtime error: Object doesn't support this property or method Microsoft JScript 运行时错误:'Sys.Extended.UI' 是 null 或者不是 object - Microsoft JScript runtime error: 'Sys.Extended.UI' is null or not an object Microsoft JScript运行时错误:对象不支持此属性或方法 - Microsoft JScript runtime error: Object doesn't support this property or method Microsoft JScript运行时错误:“ data.EmployeeDetails.EmployeeId”为null或不是对象` - Microsoft JScript runtime error: 'data.EmployeeDetails.EmployeeId' is null or not an object` 来自自动回发的错误:“ Microsoft JScript运行时错误:找不到成员。” - Error from autopostback: “Microsoft JScript runtime error: Member not found.” BHO插件(Microsoft JScript运行时错误) - BHO Plugin (Microsoft JScript runtime error) Microsoft JScript运行时错误:“ clientUploadComplete”未定义 - Microsoft JScript runtime error: 'clientUploadComplete' is undefined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM