Saturday, 4 August 2012

how to open a popup in click grideview link

JQUERY
function showpopupPRDetails() {
        $("#<%=GridViewVendorPR.ClientID%>>tbody>tr>td:nth-child(1)").find('a').css("cursor", "pointer").click(function (e) {
            e.preventDefault();
            var row = $(this).closest("tr"); //current row
            var id1 = row.find("input[type=hidden][id*=HidPRId]").val();
            if (id1 != 0) {
                var data1 = JSON.stringify({ PRId: id1 });
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    url: "../../App_WebServices/KCWebServices.svc/GetPRItemDetails",
                    data: data1,
                    dataType: "json",
                    success: insertCallback
                }); //end ajax call
                function insertCallback(result) {
                    var res = result.d;
                    if (res != null) {
                        $('#content').html(res);
                        $('#popup_box').fadeIn();
                    }
                    else {
                        alert("Could not Load PR  Details");
                    }
                }
            }
        });
    }
WCF SERVICE
[OperationContract]
        public string GetRFPItemDetails(int RFPId)
        {

            string report = "";
            if (RFPId > 0)
            {
                List<AMS_URFPDetails> rfp = new List<AMS_URFPDetails>();
                rfp = UERPManagement.GetInstance.GetAllRFPDetails(RFPId);
                StringBuilder strReport = new StringBuilder();
                strReport.Append("<table style='width:90%;margin:auto' cellpadding='4' cellspacing='4'>");
                strReport.Append("<tr><td colspan='4' align='center'><h3><u> RFP Details</u></h3></td></tr>");
                if (rfp.Count() > 0)
                {
                    strReport.Append("<tr><td align='right' style='width:25%' valign='top'> RFP No :</td><td style='width:25%' valign='top'><b>" + rfp.ToList()[0].RFPNo + "</b></td><td align='right' style='width:25%' valign='top'> RFP Title :</td><td style='width:25%' valign='top'><b>" + rfp.ToList()[0].RFPTitle + "</b></td></tr>");
                    strReport.Append("<tr><td align='right'> RFP Opening Date :</td><td><b>" + rfp.ToList()[0].RFPOpeningDate + "</b></td><td align='right'> RFP Submission Last Date :</td><td><b>" + rfp.ToList()[0].RFPSubmissionLastDate + "</b></td></tr>");
                    strReport.Append("<tr><td align='right' valign='top'> Category :</td><td valign='top'><b>" + rfp.ToList()[0].CategoryName + "</b></td><td align='right' valign='top'> Deliver Period :</td><td valign='top'><b>" + rfp.ToList()[0].DeliverPeriod + "</b>&nbsp;Days</td></tr>");
                    strReport.Append("<tr><td align='right' valign='top'> Place Of Deliver :</td><td colspan='3' valign='top'><b>" + rfp.ToList()[0].PlaceOfDeliver + "</b></td></tr>");
                    strReport.Append("<tr><td colspan='4'><table style='width:100%;text-align:center;margin:auto' border='1'>");
                    strReport.Append("<tr><td style='width:20%'><b>Asset Name</b></td><td style='width:30%'><b>Specification</b></td><td style='width:10%'><b>Quantity</b></td><td style='width:15%'><b>Unit</b></td></tr>");
                    //strReport.Append("<tr><td colspan='9'><hr/></td></tr>");    <td style='width:25%'><b>Asset Image</b></td>
                    foreach (var y in rfp)
                    {
                        strReport.Append("<tr><td>" + y.AssetName + "</td><td align='left'>" + y.AssetSpecification + "</td><td>" + y.Quantity.ToString() + "</td><td>" + y.UnitName + "</td></tr>");
                    }
                    strReport.Append("</table></td></tr>");
                }
                else
                {
                    strReport.Append("<tr>");
                    strReport.Append("<td colspan='3'>No Records Found</td>");
                    strReport.Append("</tr>");
                }
                strReport.Append("</table>");
                report = strReport.ToString();
            }

            return report;
        }
page popup
<div id="popup_box" >   
    <a id="popup_close" onclick="javascript:ClosePopup()">Close</a><br />
    <div id="content"></div>     
    </div>

No comments:

Post a Comment