Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi this is my code, in ascx file. There is problem in it. It seems that it dosen't understand Javascript!

JavaScript
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CriteriaControl.ascx.cs" Inherits="Controls_CriteriaControl" %>
<link href="../Stylesheet/table.css" rel="stylesheet" type="text/css" />
<link href="../Stylesheet/Button.css" rel="stylesheet" type="text/css" />
<link href="../Stylesheet/jquery-ui-1.8.21.custom.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="../JavaScript/jquery-1.7.2.js"></script>
<script type="text/javascript" src="../JavaScript/jquery-ui-1.8.21.custom.min.js"></script>

<script language="javascript" type="text/javascript">
    $(function () {
        $("#help-icon").button
            ({
                icons:
                {
                    primary: "ui-icon-help"
                },
                text: false
            });

        $("#help-icon").click
        {
            $(function () {
                var moveLeft = 20;
                var moveDown = 10;

                $('#help-icon').hover(function (e) {
                    $('div#pop-up').show();
                },
                        function () {
                            $('div#pop-up').hide();
                        });

                $('.help-icon').mousemove(function (e) {
                    $("div#pop-up").css('top', e.pageY + moveDown).css('left', e.pageX + moveLeft);
                });
            });
        }
    });

    $(function () {
        $("#slider-range").slider({
            range: true,
            min: 0,
            max: 100,
            values: [0, 100],
            slide: function (event, ui) {
                $("#amount1").val(ui.values[0]);
                $("#amount2").val(ui.values[1]);
            }
        });
        $("#amount1").val($("#slider-range").slider("values", 0));
        $("#amount2").val($("#slider-range").slider("values", 1));
    });
</script>



XML
<div class="divTable">
    <div class="divRow">

        <div class="divCell">
            <input type="text" id="lable" value="something" readonly="readonly"/>
            <button id="help-icon" style="width:13px ; height:13px">help</button>
            <div id="pop-up" class="divCell">
                loading...Say what u want!
            </div>
        </div>

        <div class="divCellmine">
            <label for="amount1">min:</label>
            <input type="text" id="amount1" style="border:0; font-weight:bold;" />
        </div>
           <div class="divCellmine">
        <div id="slider-range" style="width: 142px; height: 1px"></div>
           </div>
        <div class="divCellmine">
            <label for="amount2">max:</label>
            <input type="text" id="amount2" style="border:0; font-weight:bold;" />
        </div>

    </div>
</div>





this code has a lable, a button , a slider that by changing its handler two lables are changed...

I'd be glad to help me...
Thanks
Bahar
Posted
Comments
priyanka Dhoble 3-Jul-12 10:22am    
Can you explain the problem in more detail? Is it throwing some error? Is the control dynamically loaded on page?
Sandeep Mewara 3-Jul-12 10:28am    
This is not a well framed question! We cannot work out what you are trying to do/ask from the post. Please elaborate and be specific.
Use the "Improve question" link to edit your question and provide better information.
Shemeer NS 3-Jul-12 10:29am    
What problem exactly you are facing? What's going wrong this code?
bahar_Agi 3-Jul-12 23:44pm    
In fact I want to write a dynamic user control with JQuery to be client side. but it has problem in ascx. I know it is obvious that it doesn't work in a server side page.But the problem is: I don't know how to write a client side dynamic user control...

1 solution

Remove the jQuery script tags and the jQuery functions and place them into the Page instead of the user control. It will work..
 
Share this answer
 
Comments
bbirajdar 3-Jul-12 10:54am    
In that case you need to specify the path to the jQuery library from the root of the website folder

For e.g.

<script type="text/javascript" src="~/MyScripts/JavaScript/jquery-1.7.2.js"></script>
<script type="text/javascript" src="~/MyScripts/JavaScript/jquery-ui-1.8.21.custom.min.js"></script>

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900