I have a jQuery dialog box that closes right after opening. It is installed on the button located in the field of the GridView template.
My JavaScript:
<script type="text/javascript"> $(document).ready(function() { $("#txtBeginDate").datepicker(); $("#txtEndDate").datepicker(); $("#response").dialog({ autoOpen: false, modal: true, title: "Equifax Response" }); $("[id*=lnkEquifaxResponse]").live("click", function EquifaxResopnse() { $("#response").dialog("open"); }); }); </script>
My respective GridView markup:
<div id="Gridview"> <asp:GridView ID="grClientTransactions" runat="server" AllowPaging="True" PageSize="25" AutoGenerateColumns="False" DataKeyNames="ResponseXML" EmptyDataText="Record not found." EmptyDataRowStyle-BackColor="#CCCCCC" EmptyDataRowStyle-Font-Bold="true" CssClass="mGrid" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt" OnPageIndexChanging="grClientTransactions_PageIndexChanging" onrowcommand="grClientTransactions_RowCommand"> <Columns> <asp:TemplateField ShowHeader="false"> <ItemTemplate> <asp:LinkButton ID="lnkEquifaxResponse" runat="server" CausesValidation="False" CommandName="EquifaxResponse" Text="View" CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>'> </asp:LinkButton> </ItemTemplate> </asp:TemplateField> <asp:TemplateField Visible="false" HeaderText="Equifax Response"> <ItemTemplate> <asp:Label ID="lblEquifaxResponse" runat="server" Text='<%# Bind("ResponseXML")%>' > </asp:Label></div> </ItemTemplate> </asp:TemplateField> </Columns>
My div that displays the label with the assigned string from CodeBehind:
<div id="response"> <asp:Label ID="lblDialog" runat="server" ></asp:Label> </div>
source share