Using VB.NET 2010
Here is the issue I'm having:
I have a GridView with LinkButtons in Template fields.
Under the GridView I have a Panel that is hidden via CSS ( ie: display:none; ).
I have JQuery onclick event for the LinkButton; so when it's clicked the Panel slides into View under the GridView.
I'm using a class as the JQuery selector to target the LinkButton.
Here is the problem: The Panel will open but then disappear because of the PostBack of the page from the LinkButton.
Code:<style type="text/css"> .hideMe{display:none;} </style> <script type="text/javascript"> $(document).ready(function () { $("._EditLinkButton").click(function () { if ($("._panel1").is(":hidden")) { $("._panel1").show("fast"); } else { $("._panel1").slideUp(); } }); }); </script> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"> <Columns> <asp:BoundField DataField="Guid" HeaderText="Guid" /> <asp:BoundField DataField="FirstName" HeaderText="Guid" /> <asp:BoundField DataField="LastName" HeaderText="Guid" /> <asp:TemplateField> <ItemTemplate> <asp:LinkButton ID="EditLinkButton" runat="server" CommandName="EditMe" CommandArgument="EditMe" Text="EditMe" CssClass="_EditLinkButton"/> </ItemTemplate> </asp:TemplateField> <asp:ButtonField ButtonType="Link" Text="ButtonField" /> </Columns> </asp:GridView> <br /> <br /> <asp:Panel ID="Panel1" runat="server" GroupingText="Testing Panel" CssClass="_panel1 hideMe"> GUID:<asp:TextBox ID="GuidTB" runat="server" ></asp:TextBox> FirstName:<asp:TextBox ID="FirstNameTB" runat="server" ></asp:TextBox> LastName:<asp:TextBox ID="LastNameTB" runat="server" ></asp:TextBox> </asp:Panel>
How is one to get around the PostBack of some asp.net server controls when using JQuery ?




Reply With Quote