试图在另一个模型的主视图上显示部分可同步列表视图 [英] Trying to show partial ienumerable list view on main view of another model

查看:57
本文介绍了试图在另一个模型的主视图上显示部分可同步列表视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在研究Perches项目作为研究项目,

这里我正在尝试显示未付费的Perches账单中的数据是Perchestransation Table和来自Suppler表格中有供应商的所有详细信息



这里我从Perches表中选择suppler id并试图得到这个相同的Suppler perches账单的部分视图,其中余额小于总金额,

在控制器断点上他显示选定的记录但局部视图未在主视图中显示



或者这里有任何选项请给出我的想法或教程



需要帮助这个



我尝试了什么:


主视图和jQuery的
html



Hi Everybody ,
I am Working on Perches project as a study Project ,
Here i Am trying show Unpaid Perches bill which data in is Perchestransation Table and from Suppler Table there is all details of suppler

here i select suppler id from Perches table and trying to get a partial view for this same suppler perches bills where balance amount is less than total amount ,
in Controller on breakpoints he show selected records but partial view not shown in main View

or here is any option please give me an idea or tutorial

need help for this

What I have tried:

html for main View and jQuery

@model WorkingPlace.Models.Supplyer

@{
	ViewBag.Title = "PerPAYment";
}

<h2 style="color:maroon;background-color:aliceblue;background-origin:border-box;width:100% ">PERCHES PAYMENTS </h2>
<html>
<head>
	<style>
		.inv1 {
			display: none;
		}
	</style>
</head>
<body>
	<div class="PaymentDiv">
		<div class="dataDiv">
			<h3 style="color:red ;background-origin:padding-box">First Select Suppler And Then Pay The Bills as per list Selection   </h3>
			<br />
			<p>
				@Html.ActionLink("Return to perches", "Index")
			</p>
			<div>
				<table>
					<tr>
						<td style="width:40%">
							 Select Supplyer  <br />
							@Html.DropDownListFor(m => m.SupplyerID, new SelectList(Model.GetSupplyers_S, "SupplyerID", "Sypplyer_name"), "-- Select Supplyer --", new { @class = "sid form-control" })
						</td>
						<td>
							<hr />
							 
						</td>

						<td >
								 Select Payment OPtion  <br />

								@{
									var domainsList = new SelectList(new[]
									{
									  new SelectListItem { Text = "BANK", Value = "BANK", Selected = true },
									  new SelectListItem { Text = "CASH", Value = "CASH"},

									}, "Value", "Text");
@Html.DropDownList("PAymrntType", domainsList, "-- SELECT PAYMENT TYPE  --", new { @class = "PAymrntType", @id = "PAymrntType", @width = "100px" })
						</td>
						<td>
							<input type="hidden" id="supid" class="supid1" value="@TempData["SupId"]"/>
						</td>
					</tr>
				</table>
				<div id="inv" class="inv1">
					@*@Html.Partial("MyNonpaindIVN")*@
				</div>
			</div>
		</div>
	</div>
</body>
</html>
@section scripts{
<script src="~/Scripts/jquery-3.3.1.min.js"></script>
<script src="~/Scripts/jquery-ui-1.12.1.min.js"></script>
<script src="~/Scripts/chosen.jquery.min.js"></script>
<script src="~/Scripts/notify.min.js"></script>
<script>
	$(function () {
		$("#SupplyerID").chosen({
			//disable_search_threshold:5
		});
	});
	

</script>
	<script>
		$("#PAymrntType").chosen({
		});

	</script>
	<script>
		var myname;
		var myid

		$(document).on('change', '.sid', function () {
			var url = "/Perchus/Suplyerdata";
			var SupplyerID = $('#SupplyerID').val().trim();
			$.post(url, { SupplyerID: SupplyerID }, function (data) {
				myname = data.Sypplyer_name;
				myid = data.SupplyerID;
				$.notify("You selected " + " " + myname + "  " + "To Convert challan", "success");
				
			});
		});
	</script>
	<script>
		$(document).ready(function () {
			$(document).on('change', '.PAymrntType', function () {
				var typeOF = $("#PAymrntType").val().trim();
				$.notify("You Selected a Payment Type  " + typeOF, "Info")
				var supid = $('#SupplyerID').val();
				$.get("/Perchus/GetUNPAID", { SupplyerID: supid }, function (responce) {
					$('.inv1').show();
					$("#inv").html(respnse);
					@*$("#inv").load('@Url.Action("MyNonpaindIVN")');*@
					return false
				});
			});
		});
	</script>
}





部分查看





Partial View

@model IEnumerable<WorkingPlace.Models.PerchesTransaction>
@{
	Layout = null;
}

<div>
	<div class="panel-heading">
		<h3 class="panel-title">Search Results</h3>
	</div>
	<table>
		<tr>
			<td>Invoice No   :</td>
			<td>Invoice Date : </td>
			<td>Invoice Amount : </td>
			<td>Balance Amount : </td>
			<td></td>
			<td></td>
		</tr>
		@foreach (var item in Model)
		{
			<tr>
				<td id="InvoiceNo">
					@Html.DisplayFor(modelItem => item.InvoiceNo )
				</td>
				<td id="InvoiceDate">
					@Html.DisplayFor(modelItem =>item.InvoiceDate)
				</td>
				<td id="TotalAmount">
					@Html.DisplayFor(modelItem=>item.TotalAmount)
				</td>
				<td id="BalAmount">
					@Html.DisplayFor(modelItem=>item.BalAmount)
				</td>
				<td id="Pay">
					<input type="submit" id="Pay" class="pay1" value="Pay Bill"/>
				</td>
				<td>
					<input type="submit" id="cancel"class="cancel1"value="Cancel Payment"/>
				</td>
			</tr>
		}
	</table>
	<table>
		<tr class="pull-right">

			<td class="pull-right">
				Total payment
			</td>
		</tr>
	</table>
</div>





控制器



controller

public ActionResult PerPAYment(Supplyer ssp)
      {
          Supplyer model = new Supplyer
          {
              SupplyerID = ssp.SupplyerID,

              GetSupplyers_S = dc.Supplyers.ToList(),
              InfoMenu = dc.PerchesTransactions.ToList()
           };
          return View(model);
      }

      public PartialViewResult GetUNPAID(int SupplyerID)
      {
          var z = 0.00m;

          //List<PerchesTransaction> ptr = dc.PerchesTransactions.Where(p => p.SupplyerId == SupplyerID && p.TotalAmount >= z).ToList();

          Supplyer ptr = new Supplyer
          {
              InfoMenu=dc.PerchesTransactions.Where(p => p.SupplyerId == SupplyerID && p.TotalAmount >= z).ToList()
          };
          ViewData["MyNonpaindIVN"]= "MyNonpaindIVN";
          return PartialView("MyNonpaindIVN" , ptr );
      }

推荐答案

(function(){
(function () {


( #SupplyerID)。selected({
// disable_search_threshold:5
});
});


< / script>
< script>
("#SupplyerID").chosen({ //disable_search_threshold:5 }); }); </script> <script>


(#PAymrntType)。selected({
});

< / script>
< script>
var myname;
var myid
("#PAymrntType").chosen({ }); </script> <script> var myname; var myid


这篇关于试图在另一个模型的主视图上显示部分可同步列表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆