-1

I wanna use jQuery Price Range Slider With Products Interface on the website, i find some examples but they added php, how can call with c# this javascript?

<html>
  <head>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <link type="text/css" href="jquery-ui-1.8rc1.custom.css" rel="stylesheet" />

    <script type="text/javascript" src="js/jquery-1.4.1.min.js"></script>

    <script type="text/javascript" src="js/jquery-ui-1.8rc1.custom.min.js"></script>

    <script type="text/javascript">

        $(function() {

            $slider = $("#slider");//Caching slider object

            $amount = $("#amount");//Caching amount object

            $slider.slider({

                range: true, // necessary for creating a range slider

                min: 0, // minimum range of slider

                max: 500, //maximimum range of slider

                values: [75, 300], //initial range of slider

                slide: function(event, ui) { // This event is triggered on every mouse move during slide.

                    $amount.html('$' + ui.values[0] + ' - $' + ui.values[1]);//set value of  amount span to current slider values

                }

            });



            $amount.html('$' + $slider.slider("values", 0) + ' - $' + $slider.slider("values", 1));

        });

    </script>

    <title></title>

    <style type="text/css">

        body{font-size: 12px;font-family:"Arial","Helvetica","Verdana","sans-serif";}

        .left{float:left;}

        .clear{clear:both}

        #wrapper{margin:40px auto;width:940px}

        #leftSlider{width: 200px;margin-right: 30px;}

        #range{margin-bottom: 20px;}

        #products{width:710px}

        #products ul{

            list-style: none;

            margin:0px;padding:0px

        }

        #products ul li{

            margin:4px;

            float:left;

            height:180px;

            width:200px;

            background-color: #333;

            -moz-border-radius:6px;

            -webkit-border-radius:6px;

            -khtml-border-radius:6px;

        }

        #amount{font-size: 14px; text-shadow:0px 1px 0px #ccc}

    </style>

</head>



<body>

    <div id="wrapper">

        <div class="left" id="leftSlider">

            <div id="range">Price Range <span id="amount"></span></div>

            <div id="slider"></div>

        </div>

        <div class="left" id="products">

            <ul>

                <li></li>

                <li></li>

                <li></li>

                <li></li>

                <li></li>

                <li></li>

                <li></li>

                <li></li>

                <li></li>

            </ul>

        </div>

    </div>



 </body>

</html>
2
  • 3
    You haven't any PHP code there. So, how can we suggest what must be your C# code if your code isn't server-side? Commented May 31, 2011 at 13:28
  • one reason not to depend on examples is that, as in this case, seeing an example doesn't necessarily help you to understand it. Commented May 31, 2011 at 18:53

2 Answers 2

2

From MSDN docs

public static void RegisterStartupScript(
    Control control,
    Type type,
    string key,
    string script,
    bool addScriptTags
)

Parameters

control Type: System.Web.UI.Control The control that is registering the client script block.

type Type: System.Type The type of the client script block. This parameter is usually specified by using the typeof operator (C#) or the GetType operator (Visual Basic) to retrieve the type of the control that is registering the script.

key Type: System.String A unique identifier for the script block.

script Type: System.String The script.

addScriptTags Type: System.Boolean true to enclose the script block with and tags; otherwise, false.

This will generate a script block on the client side.

Sign up to request clarification or add additional context in comments.

Comments

0

As per your code, you don't have any php code in the page. You can embed this code to page and can call function

 
$(function('name') {
}); 

by giving a name to this function from code behind using Page.ClientScript.RegisterStartupScript method.

Hope this will help.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.