Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i tried following code

XML
<%@ 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
Updated 24-Jan-13 22:46pm
v2
Comments
Nick Fisher (Consultant) 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 25-Jan-13 4:46am    
i have updated my ques...see to it
thanks

1 solution

I have made some changes in your code and it worked..

XML
<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()...

...
 
Share this answer
 
v2
Comments
shivani 2013 25-Jan-13 4:45am    
i made all changes what u did over here but nothing happened
vinodkumarnie 25-Jan-13 5:15am    
Oh.. In my code in button control instead of "class" i written "calss"... Please correct it and try..
vinodkumarnie 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 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
Top Experts
Last 24hrsThis month


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