I am trying to get similar effect as this link: http://api.jquery.com/slideup/

What I am using:

vb net, JQuery,css

what I am trying to do:

I have a div with ID 'box' and inside this div, I have one span and one imagebutton. When user click on this imageButton than I want to run a JQuery scpipt to slideup this whole Div('box').

Problem:

So when I click on this imagebutton than the div slideup lil bit but than the page refresh and the effect(slideup) get canceled.

Index.aspx
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script>
        $(document).ready(function () {
            $("#closeIB").click(function () {
                $("#box").slideUp();
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
            <div id="box">
                <span>notice: </span>Write your notice message here.
                <asp:ImageButton ID="closeIB" ImageUrl="close.png" runat="server" />
            </div>
    </form>
</body>
Index.aspx.vb
Partial Class _MasterPage
    Inherits System.Web.UI.MasterPage

    Protected Sub closeIB_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles closeIB.Click

    End Sub
End Class

Try wrapping your div in an UpdatePanel.

This will allow you to update only that part of the page without calling a full postback.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.