ASP .NET Gridview paging problem with Javascript
I'm experiencing a problem when clicking on the page number within my ASP .NET gridview. When I click another page number, I am redirected to another unrelated page within my project.
This wasn't a problem until I added jQuery to my masterpage, so I'm guessing there is some sort of conflict in the javascript code. When the aforementioned redirect happens, the page PageIndexChanging event isn't fired and there isn't a postback as far as I can tell.
Has anyone else run into this? Some code is below:
<head runat="server">
<title>Vinformative</title>
<link href="style2.css" rel="stylesheet" type="text/css" media="screen" />
<link href="/favicon.ico" rel="shortcut icon" />
<meta property="og:title" content="Vinformative" />
<meta property="og:type" content="company" />
<meta property="og:url" content="http://www.vinformative.com" />
<meta property="og:image" content="http://www.vinformative.com/imgs/WEBLogoReverse480x186.png" />
<meta property="og:site_name" content="Vinformative" />
<meta property="fb:admins" content="6990" />
<script type="text/javascript" src='<%= ResolveUrl("~/js/jquery-1.4.2.min.js") %>'></script>
<script type="text/javascript" src='<%= ResolveUrl("~/js/jquery.tabSlideOut.v1.3.js") %>'></script>
<script type="text/javascript">
var directory_root = 'http://localhost:1485/Vinformative.com/'
$(function() {
$('.slide-out-div').tabSlideOut({
tabHandle: '.handle', //class of the element that will become your tab
pathToTabImage: directory_root + 'imgs/handle.gif', //path to the image for the tab //Optionally can be set using css
imageHeight: '122px', //height of tab image //Optionally can be set using css
imageWidth: '40px', //width of tab image //Optionally can be set using css
开发者_开发百科 tabLocation: 'left', //side of screen where tab lives, top, right, bottom, or left
speed: 300, //speed of animation
action: 'click', //options: 'click' or 'hover', action to trigger animation
topPos: '200px', //position from the top/ use if tabLocation is left or right
leftPos: '20px', //position from left/ use if tabLocation is bottom or top
fixedPosition: false //options: true makes it stick(fixed position) on scroll
});
$('#content').load(directory_root + 'winesearch.aspx');
});
</script>
<style type="text/css" media="screen">
.slide-out-div
{
padding: 20px;
width: 400px;
height: 310px;
background: #f2f2f2;
border: #29216d 2px solid;
}
</style>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
My Vinformative Wine Search Upload Content Add a Wine Cart Profile Logout
<%--anonymous users--%>
<asp:HyperLink runat="server" ID="lnkWhoWeare" NavigateUrl="~/WhoWeAre.aspx">What is Vinformative?</asp:HyperLink>
<asp:HyperLink runat="server" ID="lnkWhatWeDo" NavigateUrl="~/WhatWeDo.aspx">What We Do</asp:HyperLink>
<asp:HyperLink runat="server" ID="lnkLogin" NavigateUrl="~/Login.aspx">Login</asp:HyperLink>
<asp:HyperLink runat="server" ID="lnkNews" NavigateUrl="~/News.aspx">News</asp:HyperLink>
<asp:HyperLink runat="server" ID="lnkAbout" NavigateUrl="~/AboutUs.aspx">About Us</asp:HyperLink>
</div>
<%--end header links--%>
<br />
<br />
<div align="center">
<asp:Image ID="imgLogo" runat="server" AlternateText="logo" ImageUrl="~/imgs/WEBLogoReverse480x186.png" Width="480px" Height="186px" style="" Visible="false" />
</div>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
<div id="footer">
<asp:HyperLink runat="server" ID="lnkWho2" NavigateUrl="~/WhoWeAre.aspx" Visible="false">What is Vinformative?</asp:HyperLink>
<asp:HyperLink runat="server" ID="lnkWhat2" NavigateUrl="~/WhatWeDo.aspx" Visible="false">What We Do</asp:HyperLink>
<asp:HyperLink runat="server" NavigateUrl="~/TOU.aspx#TOU" ID="lnkTOU">Terms of Use</asp:HyperLink>
<asp:HyperLink runat="server" NavigateUrl="~/TOU.aspx#Privacy" ID="lnkPrivacyPolicy">Privacy Policy</asp:HyperLink>
<asp:HyperLink runat="server" NavigateUrl="~/News.aspx" ID="lnkNews2" Visible="false">News</asp:HyperLink>
<asp:HyperLink runat="server" NavigateUrl="~/AboutUs.aspx" ID="lnkAbout2" Visible="false">About Us</asp:HyperLink>
<asp:HyperLink runat="server" NavigateUrl="mailto:info@vinformative.com" ID="lnkContact">Contact</asp:HyperLink>
<br />
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:like href="http://www.facebook.com/pages/Vinformative/196975033650925" layout="button_count"
show_faces="false" colorscheme="dark"></fb:like>
<a target="_blank" href="http://www.twitter.com/Vinformative">
<img style="display: inline; position: relative; top: -2px" src="http://twitter-badges.s3.amazonaws.com/t_mini-b.png"
alt="Follow Vinformative on Twitter" border="0" width="18" height="18" valign="middle" /></a>
Copyright © 2011 Vinformative, Inc. All rights reserved.
</div>
<!-- end #footer -->
</div>
<div class="slide-out-div">
<a class="handle" href="http://link-for-non-js-users">Content</a>
<div id="content">
</div>
</div>
It is possible that you need to use the jQuery.noConflict() setting. Basically the $ token used by jQuery and from memory also in the ATLAS ajax scripts gets bugged out. Try adding the jQuery.noConflict() fix (docs http://api.jquery.com/jQuery.noConflict/)
Additionally this might indicate old versions...
精彩评论