Call javascript function with value in code-behind

reza yavari

How to call JavaScript function with value from ASP.NET code behind? I have JavaScript function and I am using it in a div tag

but when i call my function nothing happen ! why ?

( my parameter is path of picture and i want set this path in my div tag to view picture. )

my html code :

<div id="myPano" class="pano">

    </div>

my javascript

 <script>
    function myFunction(imgz) {
        $(document).ready(function () {
            $("#myPano").pano({
                img: imgz

            });
        });
    }

</script>

and code behind ( button click )

 Dim imgz As String
    imgz = "img/sphere.jpg"
    System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "Script", "myFunction(" & imgz & ")", True)

Thank you.

Jai

I can suggest you to add a string to the value:

    System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "Script", "myFunction('" & imgz & "')", True)

and you don't have to put your .pano code inside dom ready:

<script>
    function myFunction(imgz) {
        $("#myPano").pano({
            img: imgz
        });
    }
</script>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Call Code Behind Function from JavaScript (not AJAX!)

From Dev

call function from code behind in javascript without postback

From Dev

How to call ascx function code behind using javascript? DotNetNuke

From Dev

How to call JavaScript Function From ASP Code Behind?

From Dev

Ext.Net - Call the javascript function form code behind

From Dev

Javascript method call from code behind

From Dev

How to call Javascript method from code behind

From Dev

JavaScript: Not calling javascript function from the code behind

From Dev

How do I call a JavaScript function from Asp.Net Code Behind?

From Dev

passing a variable to javascript function from code behind

From Dev

Javascript function is not being called from code behind

From Dev

How to bind code behind variable value to javascript?

From Dev

How to pass a value from JavaScript to code behind?

From Dev

Getting a value from a JavaScript function to my ASP.NET / C# Code-Behind

From Dev

Call a list in code behind of ASPX , in javascript code in foreach loop?

From Dev

Call js function from code-behind (Not as startupScript)

From Dev

How can i call function in code behind in if condition

From Dev

how to call a written function in .aspx page from code behind

From Dev

call on class click function in asp.net code behind

From Dev

How to get the binding value in code behind for phone call Task?

From Dev

How to call javascript from code behind for Repeater control

From Dev

lost value on code behind

From Dev

How to pass a bool to a JavaScript function from code behind?

From Dev

Pass List<int> from code behind to use in Javascript function

From Dev

Pass parameter to Javascript function from ASP code behind

From Dev

Calling JavaScript function from code behind after Response.End()

From Dev

How to pass comma separate string in JavaScript function from Code behind?

From Dev

Code behind button only posting back, not calling javascript function

From Dev

Pass List<int> from code behind to use in Javascript function

Related Related

  1. 1

    Call Code Behind Function from JavaScript (not AJAX!)

  2. 2

    call function from code behind in javascript without postback

  3. 3

    How to call ascx function code behind using javascript? DotNetNuke

  4. 4

    How to call JavaScript Function From ASP Code Behind?

  5. 5

    Ext.Net - Call the javascript function form code behind

  6. 6

    Javascript method call from code behind

  7. 7

    How to call Javascript method from code behind

  8. 8

    JavaScript: Not calling javascript function from the code behind

  9. 9

    How do I call a JavaScript function from Asp.Net Code Behind?

  10. 10

    passing a variable to javascript function from code behind

  11. 11

    Javascript function is not being called from code behind

  12. 12

    How to bind code behind variable value to javascript?

  13. 13

    How to pass a value from JavaScript to code behind?

  14. 14

    Getting a value from a JavaScript function to my ASP.NET / C# Code-Behind

  15. 15

    Call a list in code behind of ASPX , in javascript code in foreach loop?

  16. 16

    Call js function from code-behind (Not as startupScript)

  17. 17

    How can i call function in code behind in if condition

  18. 18

    how to call a written function in .aspx page from code behind

  19. 19

    call on class click function in asp.net code behind

  20. 20

    How to get the binding value in code behind for phone call Task?

  21. 21

    How to call javascript from code behind for Repeater control

  22. 22

    lost value on code behind

  23. 23

    How to pass a bool to a JavaScript function from code behind?

  24. 24

    Pass List<int> from code behind to use in Javascript function

  25. 25

    Pass parameter to Javascript function from ASP code behind

  26. 26

    Calling JavaScript function from code behind after Response.End()

  27. 27

    How to pass comma separate string in JavaScript function from Code behind?

  28. 28

    Code behind button only posting back, not calling javascript function

  29. 29

    Pass List<int> from code behind to use in Javascript function

HotTag

Archive