Drag Record in CRM from Two Entity from Asp.net Application and Create

1.Use Jaquery http://jqueryui.com/download/    1.10

<script>
        $(function () {
            $(".draggable").draggable();
            $(".droppable").droppable({
                drop: function (event, ui) {
                    //debugger;
                    //window.open();
                    var lnk = $(this).parent().get(0).childNodes[0].childNodes[0].href;
                    // console.log($(this).parent().eq(0).children().eq(0).find('a').text());
                    // console.log($('.arif'));
                    enrGUID = $(ui.draggable).eq(0).find('a').attr('enrid');
                    enrName = $(ui.draggable).eq(0).find('a').text();
                    BatchName = $(this).parent().get(0).childNodes[1];
                    CourseName = $(this).parent().get(0).childNodes[2];
                    batchId = $(this).parent().eq(0).children().eq(0).find('a').text();
                    batchGUID = $(this).parent().eq(0).children().eq(0).find('a').attr('batchId');
                    lnk.match(/id=(.*)/);
                    if ($(this.parentElement).hasClass('enroll') == false) {
                        $(function () {
                            $("#dialogError").dialog({
                                modal: true,
                                buttons: {
                                    close: function () {
                                        $(this).dialog("close");
                                        $('#batchId').html(batchId);
                                        return true;
                                    }
                                }
                            });
                        });
                        return;
                    }
                    if ($(event.srcElement.parentElement.parentElement).hasClass('posted') == false) {
                        $(function () {
                            $("#dialogError").dialog({
                                modal: true,
                                buttons: {
                                    close: function () {
                                        $(this).dialog("close");
                                        $('#batchId').html(batchId);
                                        return true;
                                    }
                                }
                            });
                        });
                        return;
                    }
                    var dlg = $("#dialog").dialog({
                        //autoOpen: true,
                        height: 300,
                        width: 350,
                        draggable: true,
                        resizable: true,
                        //modal: true,
                        open: function (event, ui) {
                            $('#BatchName').html(BatchName);
                            $('#CourseName').html(CourseName);
                            $('#batchId').html(batchId);
                            $('#enrName').html(enrName);
                            $('#ContentPlaceHolder1_hdnBatchID').val(batchGUID);
                            $('#ContentPlaceHolder1_hdnEnrID').val(enrGUID);
                        }
                    });
                    dlg.parent().appendTo(jQuery("form:first"));
                }

            });
        });

    </script>



in HTML

  <div id="dialogError" style="display: none">
      This is not Valid
  </div>
    <div id="dialog" style="display: none">
        <table id="hidethis">
            <tr>
                <td><span class="newStyle1">Batch Detail </span></td>
            </tr>
            <tr>
                <td width="20" id="Td3">ID:</td>
                <td id="batchId"></td>
            </tr>
            <tr>
                <td width="100" id="Td4">Batch Name:</td>
                <td id="BatchName"></td>
            </tr>
            <tr>
                <td width="100" id="Td1">Course Title:</td>
                <td id="CourseName"></td>
            </tr>
            <tr>
                <br>
                <td  width="100"><span class="newStyle1">Enrollment</span></td>
            </tr>

            <tr>
                <td id="Td2">ID:</td>
                <td id="enrName">&nbsp;</td>
            </tr>

        </table>
        <br />
        <br />
        <asp:HiddenField runat="server" ID="hdnBatchID"></asp:HiddenField>
        <asp:HiddenField runat="server" ID="hdnEnrID"></asp:HiddenField>
        <asp:Button runat="server" ID="btnSubmit" Text="Submit" OnClick="btnSubmit_Click1"/>
        <asp:Button runat="server" ID="btnCancel" Text="Cancel" OnClick="btnCancel_Click" OnClientClick="$(form).submit();" />
    </div>

Comments