2

I am using jquery ui tabs and tooltip and it works perfectly.Heres the code for jquery-ui tabs

$(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

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

Here's my aspx page

<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>

1 Answer 1

1

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);
Sign up to request clarification or add additional context in comments.

2 Comments

thanks for the reply.now i am getting syntax error and when i checked in on errorconsole(firefox) it show the following line <script type="text/javascript">setDiv('highlight');
@Kannan Apologies, set that last parameter to false, not true

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.