Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
i tried following code
 
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="animate.aspx.cs" Inherits="animate" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
 
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>
 
<script type="text/javascript">
    $(document).ready(function () {
        $("#button1").click(function () {
            $("div").animate({ left: '250px' });
            return false;
        });
    });
</script>
 

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
 

    <asp:Button ID="button1" runat="server" Text="statrt" />
<p>By default, all HTML elements have a static position, and cannot be moved. To manipulate the position, remember to first set the CSS position property of the element to relative, fixed, or absolute!</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
<div style="background:#98bf21;height:100px;width:100px;position:relative;">
</div>
 
</asp:Content>
 

MASTER PAGE
 
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="SiteMaster" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
    <title></title>
    <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
    <asp:ContentPlaceHolder ID="HeadContent" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form runat="server">
    <div class="page">
        <div class="header">
            <div class="title">
                <h1>
                    My ASP.NET Application
                </h1>
            </div>
            <div class="loginDisplay">
                <asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
                    <AnonymousTemplate>
                        [ <a href="~/Account/Login.aspx" ID="HeadLoginStatus"  runat="server">Log In</a> ]
                    </AnonymousTemplate>
                    <LoggedInTemplate>
                        Welcome <span class="bold"><asp:LoginName ID="HeadLoginName" runat="server" /></span>!
                        [ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Log Out" LogoutPageUrl="~/"/> ]
                    </LoggedInTemplate>
                </asp:LoginView>
            </div>
            <div class="clear hideSkiplink">
                <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
                    <Items>
                        <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/>
                        <asp:MenuItem NavigateUrl="~/About.aspx" Text="About"/>
                    </Items>
                </asp:Menu>
            </div>
        </div>
        <div class="main">
            <asp:ContentPlaceHolder ID="MainContent" runat="server"/>
        </div>
        <div class="clear">
        </div>
    </div>
    <div class="footer">
        
    </div>
    </form>
</body>
</html>
 

 

not getting output
but using without master page its working
pls tell
regards
Posted 24-Jan-13 1:02am
Edited 24-Jan-13 22:46pm
v2
Comments
Nick Fisher (Consultant) at 24-Jan-13 7:36am
   
Unless you post your Master Page code it's very hard to tell, as there may be some script or other errors on that page that's preventing this from running.
shivani 2013 at 25-Jan-13 4:46am
   
i have updated my ques...see to it
thanks

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I have made some changes in your code and it worked..
 
<script type="text/javascript">
    $(document).ready(function () {
        $(".btn_submit1").click(function () {
            $(".div_animate1").animate({ left: '250px' });
            return false;
        });
    });
</script>
 

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
 

    <asp:Button ID="button1" runat="server" class="btn_submit1" Text="statrt" />
<p>By default, all HTML elements have a static position, and cannot be moved. To manipulate the position, remember to first set the CSS position property of the element to relative, fixed, or absolute!</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
<div class="div_animate1" style="background:#98bf21;height:100px;width:100px;position:relative;">
</div>
 
In above your code

1. There may your are using Button id to capture button click event. Since you are using Master page there may be chances of Unambiguity of id's of controls...
 
I sugests...
 
1. Use class names for each controls to capture event's occur..
2. Have unique class names for each controls...
3. Don't use tag names.. Instead use unique class names...
Ex: instead $("div").animate(); used $(".div_animate1").animate()...

...
  Permalink  
v2
Comments
shivani 2013 at 25-Jan-13 4:45am
   
i made all changes what u did over here but nothing happened
vinodkumarnie at 25-Jan-13 5:15am
   
Oh.. In my code in button control instead of "class" i written "calss"... Please correct it and try..
vinodkumarnie at 25-Jan-13 5:27am
   
Hi... I have done above changes to your code only.. I put class instead of id and it worked well.... Check again..
vinodkumarnie at 25-Jan-13 5:28am
   
If you want your code back that i have made changes please let me know.. I will paste the same..

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

  Print Answers RSS
0 OriginalGriff 375
1 Prakriti Goyal 242
2 Yogesh Kumar Tyagi 224
3 Sergey Alexandrovich Kryukov 158
4 CPallini 150
0 OriginalGriff 6,742
1 Sergey Alexandrovich Kryukov 5,479
2 Maciej Los 3,474
3 Peter Leow 3,313
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 25 Jan 2013
Copyright © CodeProject, 1999-2014
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