Click here to Skip to main content
13,356,318 members (63,900 online)
Rate this:
Please Sign up or sign in to vote.
See more:
<script type="text/javascript" src="" />
    <script type="text/javascript" language="javascript">
        function buttonclick() {

    <script type="text/javascript" language="javascript">

        $(document).ready(function() {
            $("#Button2").click(function() {
            $(function autoComp() {
                //  alert('hello');
                var textb = document.getElementById('TextBox1').value;

                if ((textb != null) && (textb != "")) {
                    if (parseInt(textb) == 0) {
                        $("#image1").fadeTo("fast", 0.15);
                        $("#image2").fadeTo("fast", 0.15);
                        $("#image3").fadeTo("fast", 0.15);
                        $("#image4").fadeTo("fast", 0.15);
                        $("#image4").fadeTo("fast", 0);

                    if (parseInt(textb) == 25) {

                        $("#image1").fadeTo("fast", 0.25);
                        $("#image2").fadeTo("fast", 0.25);
                        $("#image3").fadeTo("fast", 0.25);
                        $("#image4").fadeTo("fast", 0.25);
                    if (parseInt(textb) == 50) {
                        $("#image1").fadeTo("fast", 0.5);
                        $("#image2").fadeTo("fast", 0.5);
                        $("#image3").fadeTo("fast", 0.5);
                        $("#image4").fadeTo("fast", 0.5);
                    if (parseInt(textb) == 75) {
                        $("#image1").fadeTo("fast", 0.75);
                        $("#image2").fadeTo("fast", 0.75);
                        $("#image3").fadeTo("fast", 0.75);
                        $("#image4").fadeTo("fast", 0.75);

                    if (parseInt(textb) == 100) {
                        $("#image1").fadeTo("fast", 1);
                        $("#image2").fadeTo("fast", 1);
                        $("#image3").fadeTo("fast", 1);
                        $("#image4").fadeTo("fast", 1);

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<div id="div1" style="background-color: #000000"  runat="server">
<asp:Image ID="image1" runat="server" AlternateText="Ledbulb" ImageUrl="Images/Transparent_Bulb.png" />
    ;<asp:Image ID="image2" runat="server" AlternateText="Ledbulb" ImageUrl="Images/Transparent_Bulb.png" />

<asp:Image ID="image3" runat="server" AlternateText="Ledbulb" ImageUrl="Images/Transparent_Bulb.png" />

<asp:Image ID="image4" runat="server" AlternateText="Ledbulb" ImageUrl="Images/Transparent_Bulb.png" />
    <br />
    <asp:Image ID="Image5" runat="server" Width="100%" ImageUrl="~/Images/Road.PNG" />
    <br />

    <asp:Label ID="Label1" runat="server" Text="PoleID : P1" ForeColor="White" Font-Bold="True"></asp:Label>

    <br />
    <asp:Label ID="Label5" runat="server" Font-Bold="True" ForeColor="White"

        Text="DutyCapaciy :"></asp:Label>
<asp:Label ID="lblDC1" runat="server" ForeColor="White" >NULL</asp:Label>

<asp:Button ID="Button2" runat="server" Text="Display"/>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:UpdateProgress ID="UpdateProgress1" runat="Server" AssociatedUpdatePanelID="UpdatePanel1" DisplayAfter="1" >
<ProgressTemplate>Update in Progress……..  </ProgressTemplate>

The above code it is working in individual page fine but whenever i add the master page it is not working help me from this
Posted 4-Jan-13 22:41pm
Updated 4-Jan-13 22:54pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

working in individual page fine but whenever i add the master page it is not working
This is because with Masterpage, the actual ID's of server control are little different.

To have a quick and easy solution, do a 'View Source' of the webpage and get the ID of the control you need and use that ID in JavaScript.

Another way is to use delimiters like:
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Whenever you add masterpage, control ID's will change, you can view it via view source of your browser.

var textb = document.getElementById('TextBox1').value;

Above won't work when there is masterpage added. Do as sandeep mewara suggested, you can also do the following

var textb = document.getElementById('contentplaceholeID').value

paste the id of your control after viewing the source of your page.


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 |
Web02 | 2.8.180111.1 | Last Updated 5 Jan 2013
Copyright © CodeProject, 1999-2018
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