Click here to Skip to main content
11,578,524 members (60,617 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: jQuery VB.NET
hi, i have this jqery function
<pre lang="Javascript"> <script type="text/javascript">
    $(document).ready(function Ocultar() {
        $('#toggle-right').toggle(function Ocultar1() {
                width: "850px",
                backgroundColor: "#ffffff"
            }, 400);
            $('#button-right-sidebar').animate({ right: "850px" });
        }, function () {
                width: "0px",
                backgroundColor: "#00000"
            }, 400);
            $('#button-right-sidebar').animate({ right: "0px" });            
        $('#toggle_medidas').toggle(function () {
                width: "90px",
                backgroundColor: "#ffffff"
            }, 400);
            //$('#botonMedidas').animate({ left: });

        }, function () {
                display: "none", width: "0px",
                backgroundColor: "#00000"
            }, 400);
            //$('#botonMedidas').animate({ left:  });

and i'm trying to call from code behid in a button event
i hope someone can help me

Posted 7-Feb-13 8:35am
db7uk at 7-Feb-13 14:44pm
why not call the function from the client side? calling from server side makes no sense? what are you trying to do?
FelipeVazquez at 7-Feb-13 14:59pm
I have a div that opens and closes with this function, and a button that updates an updatepanel, I want the div is closed by pressing the button without the page is updated
I put this code on the button event
Page.ClientScript.RegisterStartupScript(Me.GetType(), "toggle", "Ocultar();", True)
but does not work
thanks for your help

pd: sorry for my english
aspnet_regiis -i at 7-Feb-13 23:40pm
Here is your confusion - Page.ClientScript.RegisterStartupScript(Me.GetType(), "toggle", "Ocultar();", True) ..Is used for registering the script on the page. However , the client side script - javascript has to be 'called/executed' from client side only...

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

From your question, I have guessed that you are a novice in web technologies and web development..

You should remember that ..
1. HTTP is a stateless protocol. A server does not know who the client is. It only responds to the requests from the client. So it cannot call a client side function.

Rather you should call this function in the client side click event..
FelipeVazquez at 7-Feb-13 15:10pm
it's that obvious?
Thanks for your answer, helped me see it from another angle
aspnet_regiis -i at 7-Feb-13 15:14pm
Yes..The javascript is loaded on client side..So you can execute it on the client side itself....
db7uk at 7-Feb-13 15:59pm
Good answer
aspnet_regiis -i at 7-Feb-13 23:37pm
Thank you
Sergey Alexandrovich Kryukov at 7-Feb-13 18:39pm
It's a rare case OP could get it. Many perceive it as this is impossible because the advisor is bad. :-)
My 5.
aspnet_regiis -i at 7-Feb-13 23:37pm
Thank you SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Peter Leow 135
1 OriginalGriff 113
2 Richard MacCutchan 85
3 Frankie-C 75
4 Afzaal Ahmad Zeeshan 75
0 OriginalGriff 904
1 Sergey Alexandrovich Kryukov 715
2 Abhinav S 573
3 F-ES Sitecore 420
4 Suvendu Shekhar Giri 393

Advertise | Privacy | Mobile
Web03 | 2.8.150603.1 | Last Updated 7 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100