Click here to Skip to main content
15,067,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am loading an HTML page in ajax modal on the click of a button inside a repeater.

$(".ajax-link").on('click', function (e) {
               e.preventDefault();
               $("html, body").addClass("hid-body");
               $(".ajax-modal-overlay").fadeIn(400);
               $(".ajax-modal-container").animate({
                   right: "0",
                   opacity: 1
               }, 300);
               $.ajax({
                   url: this.href,
                   success: function (html) {
                       $("#ajax-modal").empty().append(html);
                       initHiddenGal();
                       $(".ajax-modal-overlay , .ajax-modal-close").on('click', function () {
                           //$(document.body).append("#aspnetForm");
                           $("html, body").removeClass("hid-body");
                           $(".ajax-modal-overlay").fadeOut(100);
                           $(".ajax-modal-container").animate({
                               right: "-550px",
                               opacity: 0
                           }, 300);
                           setTimeout(function () {
                               $("#ajax-modal").empty();
                               $(".ajax-loader").fadeIn(100);
                           }, 300);
                       });
                   }
               });
               $(".ajax-loader").delay(700).fadeOut(400);
               setTimeout(function () {
                   $(".ajax-modal-wrap").animate({
                       opacity: "1"
                   }, 300);
               }, 1000);
               return false;
           });


after using the modal opening link, Other link buttons Clicks on the Main page gives the error as
Form submission canceled because the form is not connected


Repeater Code
<pre>    <pre lang="c#"><asp:Repeater ID="Site_Grid" runat="server" Visible="false" OnItemDataBound="Site_Grid_ItemDataBound" OnItemCreated="Site_Grid_ItemCreated" OnItemCommand="Site_Grid_ItemCommand">
        <ItemTemplate>
            <div class="listing-item has_one_column">
                <article class="geodir-category-listing fl-wrap grid-item-holder">
                    <div class="geodir-opt-list">
                        <%--Ajax Link--%>
                        <a href="MediaPanel.aspx?<%#Eval("PageUrl") %>" class="geodir-js-favorite ajax-link">class="fal fa-eye"><span class="geodir-opt-tooltip">View Details</span></a>
                        <%--LinkButton--%>
                        <asp:LinkButton ID="LinkButton6" runat="server" CommandName="AddtoPlan" CommandArgument='<%# Eval("Id")%>' class="geodir-js-booking add" Text="Add">^__i class="fal fa-plus"><span class="geodir-opt-tooltip">Add</span>
                        </asp:LinkButton>
                    </div>
                </article>
            </div>
        </ItemTemplate>
    </asp:Repeater>


What I have tried:

I tried appending form again on close button of modal.
 $(".ajax-modal-overlay , .ajax-modal-close").on('click', function () {
$(document.body).append("#aspnetForm");

But i am still getting the same error. Please Help.
Posted
Updated 15-Jan-20 1:54am
v2
Comments
ZurdoDev 15-Jan-20 10:24am
   
.append("#aspnetForm") will just append the text #aspnetForm. You need to append the form itself.
document.body.appendChild($("#aspnetForm"))
Sanjeev236 15-Jan-20 12:16pm
   
I tried the same but No Luck. :(

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