Skip to main content

Open Mvc View IN pop up same page

PopUp Design
 <div class="modal fade" id="BidTrailModal" data-backdrop="static">

            <!-- Change class .modal-sm to change the size of the modal -->
            <div class="modal-dialog modal-sm modal-lg" role="document">


                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title w-100" id="myModalLabel">Bid Trail</h4>
                        <button type="button" class="close" data-dismiss="modal" style="margin-top:-35px" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body" style="height:350px; overflow:auto">
                        <form>
                            <div id="divBidTrail">

                            </div>

                        </form>
                    </div>
                    @*<div class="modal-footer">
                            <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">Close</button>
                            <button type="button" class="btn btn-primary btn-sm">Save changes</button>
                        </div>*@
                </div>
            </div>
        </div>


Ajx Call 

$(document).on("click", "#linkBidHistory", function () {

            $.get('@Url.Action("BidTrail", "Shipper", new { bidid = ViewBag.BidId } )', function (data) {
                $('#divBidTrail').html(data);
            });
            $("#BidTrailModal").modal("show");


        })


controller FUnction

   public ActionResult BidTrail(int bidid)
        {
            List<BidAuditTrail> LBAT = new List<BidAuditTrail>();
            string constr = ConfigurationManager.ConnectionStrings["NLPConn"].ConnectionString;
            using (SqlConnection con = new SqlConnection(constr))
            {
                SqlCommand cmd = new SqlCommand("sp_NLP_GetBidTrail", con);
                cmd.CommandType = CommandType.StoredProcedure;
                int bid = bidid;
                cmd.Parameters.AddWithValue("@Bidid", bidid);


                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable dt = new DataTable();
                da.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        BidAuditTrail bat = new BidAuditTrail();
                        bat.createddate = Convert.ToDateTime(dt.Rows[i][0]);
                        bat.bid_LSP = Convert.ToString(dt.Rows[i][1]);
                        bat.BidAmount = Convert.ToString(dt.Rows[i][2]);
                        bat.Status = Convert.ToString(dt.Rows[i][3]);
                        bat.remark = Convert.ToString(dt.Rows[i][4]);

                        LBAT.Add(bat);
                    }

                }

            }
            return PartialView("ShipperAuditTrail", LBAT);
        }







Partial View


@using NLP.Models
@model  IEnumerable<BidAuditTrail>

@if (Model.Count() > 0)
{
    <table class="table table-bordered" style="border: 1px solid #ddd !important;">
        <thead>
            <tr>
            <td style="text-align:center;">Time Stamp</td>
            <td style="text-align:center;">Organization</td>
            <td style="text-align:center;">Bid Amount</td>
            <td style="text-align:center;">Status</td>
            <td style="text-align:center;">Remark</td>
            </tr>
            
        </thead>
        <tbody>
            
            @foreach (var m in Model)
            {
                <tr>
                    <td style="text-align:center;">@m.createddate.ToString("dd/MM/yyyy hh:mm")</td>
                    <td style="text-align:center;">@m.bid_LSP</td>
                    @*<td style="text-align:right;"><label>@String.Format("{0:n0}", (Convert.ToInt32(m.BidAmount)))</label></td>*@
                    <td style="text-align:right;"><label>@m.BidAmount</label></td>
                    <td style="text-align:center;">@m.Status</td>
                    <td style="text-align:center;">@m.remark</td>

                </tr>
            }
            
        </tbody>


    </table>
}
else
{
    <text>No actions performed on this Bid yet</text>
}










Popular posts from this blog

Add barcode on pdf

using System; using System.IO; using System.Drawing; using ZXing; using iTextSharp.text; using iTextSharp.text.pdf; using System.Drawing; using System.Web.UI.WebControls; namespace PDFBarcode {     public partial class WebForm1 : System.Web.UI.Page     {         byte[] byteImage;         protected void Page_Load(object sender, EventArgs e)         {         }         protected void btnDownload_Click(object sender, EventArgs e)         {                       Random r = new Random();             string fileName = r.Next().ToString();             string filenameext = fileName + ".pdf";             GenerateBarcode(fileName);             string Sourcepath = Server.MapPath("~/SavedF...

Dynamic Menu in asp.net using Listview

 1.    public DataTable LoadMenu()         {             MenuBal MenuBal = new MenuBal();             DataSet ds = this.GetData(0);             PopulateMenu(ds);             return ds.Tables[2];         }     private DataSet GetData(int parentMenuId)         {             MenuBal objmenu = new MenuBal();             string Mode = "";             if (Session["Mode"] != null)             {                 Mode = Session["Mode"].ToString();             }             DataSet ds = objmenu.GetData(parentMenuId, Convert.ToInt32(SessionHelper.CurrentUserId), Mode, SessionHelper...