This is a simplified version of what I want to do. Basically I have a datalist with a bunch of things in it, and when you hover over the datalist, I want jquery to hide / show stuff. The problem is that after I bind to the data, my jQuery gridview / repeatater / datalist will exit if gridview / replater / datalist is in the update panel.
After you click the button in the example below, jQuery, which makes the scroll appear when you hover over it.
Any ideas why this is happening, how to fix it or the best way to do it?
<script type="text/javascript"> $(document).ready(function() { $('.comment-div').mouseenter(function() { jQuery("span[class=mouse-hide]", this).fadeIn(50); }); $('.comment-div').mouseleave(function() { jQuery("span[class=mouse-hide]", this).fadeOut(50); }); }); </script> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <div class="comment-div"> <asp:GridView ID="GridView1" runat="server"> </asp:GridView> <span class="mouse-hide" style="display: none;">sdfgsdfgsdfgsdfg</span> </div> <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /> </ContentTemplate> </asp:UpdatePanel>
And the code:
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { BindStuff(); } } public void BindStuff() { TestDB db = new TestDB(); var x = from p in db.TestFiles select new { p.filename}; x = x.Take(20); GridView1.DataSource = x; GridView1.DataBind(); } protected void Button1_Click(object sender, EventArgs e) { BindStuff(); }
Jason source share