Click here to Skip to main content
13,089,433 members (58,730 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 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 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 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 7-Feb-13 15:10pm
it's that obvious?
Thanks for your answer, helped me see it from another angle
aspnet_regiis -i 7-Feb-13 15:14pm
Yes..The javascript is loaded on client side..So you can execute it on the client side itself....
db7uk 7-Feb-13 15:59pm
Good answer
aspnet_regiis -i 7-Feb-13 23:37pm
Thank you
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 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
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 7 Feb 2013
Copyright © CodeProject, 1999-2017
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