Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 无法将值显示到文本框';在第二次使用Jquery时_Asp.net Mvc_Asp.net Mvc 3_Asp.net Mvc 4 - Fatal编程技术网

Asp.net mvc 无法将值显示到文本框';在第二次使用Jquery时

Asp.net mvc 无法将值显示到文本框';在第二次使用Jquery时,asp.net-mvc,asp.net-mvc-3,asp.net-mvc-4,Asp.net Mvc,Asp.net Mvc 3,Asp.net Mvc 4,我正在开发MVC应用程序 我已经显示了确认模式框 它只能一次正常工作。。。。如果我再打开它,它根本不工作。。。 查看下面的图片 当我将条目放入dispatch文本框(34)中时,在blur事件中,它乘以bundle size值(60)并显示在Pisces文本框(2040)中。工作正常 当我关闭并再次打开该框,并将值再次放入分派文本框时,它根本不起作用 这是我的密码 <h2 style="font-size:22px;">Dispatch </h2> <scr

我正在开发MVC应用程序

我已经显示了确认模式框

它只能一次正常工作。。。。如果我再打开它,它根本不工作。。。 查看下面的图片

当我将条目放入dispatch文本框(34)中时,在blur事件中,它乘以bundle size值(60)并显示在Pisces文本框(2040)中。工作正常

当我关闭并再次打开该框,并将值再次放入分派文本框时,它根本不起作用

这是我的密码

<h2 style="font-size:22px;">Dispatch </h2>


<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
 @using (Html.BeginForm("Create", "Dispatch", FormMethod.Post, new { enctype = "multipart/form-data", id = "frmCreate" }))

{
        @Html.ValidationSummary(true)   


  <div class="row-fluid">        

       <div class="span12 roundedDiv" >

           <div class="span12" style="margin-left:0px; margin-bottom:10px;">
          <legend style="color:#ee8929; font-size:16px;">Primary Information</legend>

        </div>



           <div class="span12" style="margin-left:0px; margin-bottom:10px;">
          <legend style="color:#ee8929; font-size:16px;">Product List</legend>

      <div class="row-fluid">   
           <table class="table table-striped table-hover" id="mytable">
               <thead>
    <tr >
        <th>
          Section Name
        </th>
         <th>
          Section Code
        </th>

    </tr>
</thead>

<tbody id="tbody">


@foreach (var item in ViewBag.ProductList)

{
    <tr id="tableRow" >
        <td  >
            @item.SectionName
        </td>

            <td >
            @item.SectionCode
        </td>

         <td  id="editRow" >

          <a href="#" class="editClass"  style="font-size: 12px; text-decoration: none; margin-right: 10px;">Edit </a>        

         </td>

    </tr>
}

</tbody>

</table>

</div>

 </div>
    <div class="span11" >              
        <div class="span3"> Order Date : @System.DateTime.Now.ToShortDateString()</div>
            <div class="span9" style="text-align:right">
                <button   type="button" class="btn btn-primary" id="btnDispatch" >Dispatch</button>
                <input class="btn btn-default" value="Back" style="width:40px;" onclick="window.location.href='@Url.Action("index")    '"/>
            </div>
        </div>
    </div>
  </div>
} 





<script type="text/javascript">
    $(document).ready(function () {

        $('.editClass').click(function () {


            $('body').append('<div id="dataConfirmModal" class="modal" role="dialog" aria-labelledby="dataConfirmLabel" aria-hidden="true"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true" id="btnClose1"> × </button><h5 id="dataConfirmLabel">Edit </h5> </div><div class="modal-body" ><html><table style="width:530px"><tr> <th style="width:120px">Bundle Size</th><th>Count</th><th>Dispatch</th> <th> Pieces</th> </tr><tr> <td><div id="bundleSize1" >60 </div></td> <td><div  id="count1">3</div></td>  <td><input  id="dispatchValue1" type="text"  style="width:100px ;height:15px ;margin:1px" /></td> <td> <input  id="pieces1"  type="text"  style="width:100px ;height:15px ;margin:1px" disabled/></td> </tr> <tr> <td><div id="bundleSize2" >10</div></td> <td><div  id="count2">8</div></td><td><input id="dispatchValue2" type="text" style="width:100px ;height:15px ;margin:1px" /></td><td> <input   id="pieces2"  type="text"  style="width:100px ;height:15px ;margin:1px" disabled/></td> </tr> <tr style="border-bottom:solid #e8eef4 thick;"> <td><div id="bundleSize3" >1</div></td><td><div  id="count3">20</div></td><td><input id="dispatchValue3" type="text" style="width:100px ;height:15px ;margin:1px" /></td><td> <input    id="pieces3" class="txt" type="text"  style="width:100px ;height:15px ;margin:1px" disabled/></td>  </tr> <tr> <td colspan="3" style ="text-align: right; border-right:solid white;"> Total</td> <td> <input  id="total" type="text" value="0"  style="width:100px ;height:15px ;margin:1px"  disabled /></td></tr></table> </html></div> <div class="modal-footer"><button type="button" id="btnOk1"  class="btn btn-primary" data-dismiss="modal" aria-hidden="true" >OK</button> <button type="button" id="btnCancel1"  class="btn btn-default" data-dismiss="modal" aria-hidden="true" >Cancel</button> </div></div> ');

            $('#dataConfirmModal').find('.modal-body').text($(this).attr('data-confirm'));
            $('#dataConfirmModal').modal({ show: true }); 

        });

        $('body').on('click', '#btnOk1', function() {


        });

        $('body').on('click', '#btnCancel1', function() {

            var url="@Url.Action("DispatchNow")";
            $(location).attr('href', url);
        });

        $('body').on('click', '#btnClose1', function() {

            var url="@Url.Action("DispatchNow")";
            $(location).attr('href', url);
        });
调度
@使用(Html.BeginForm(“Create”、“Dispatch”、FormMethod.Post、new{enctype=“multipart/formdata”、id=“frmCreate”}))
{
@Html.ValidationSummary(true)
主要信息
产品清单
节名
区段代码
@foreach(ViewBag.ProductList中的变量项)
{
@item.SectionName
@项目1.2代码
}
订单日期:@System.DateTime.Now.ToShortDateString()
派遣
} 
$(文档).ready(函数(){
$('.editClass')。单击(函数(){
$('body').append('x编辑捆绑大小计数分派件60 3 10 8 120总计确定取消');
$('#dataConfirmModal').find('.modal body').text($(this.attr('data-confirm'));
$('#dataConfirmModal').modal({show:true});
});
$('body')。在('click','btnOk1',函数()上{
});
$('body')。在('click','btnCancel1',函数()上{
var url=“@url.Action”(“DispatchNow”);
$(location.attr('href',url);
});
$('body')。在('click','btnClose1',函数()上{
var url=“@url.Action”(“DispatchNow”);
$(location.attr('href',url);
});
下面是文本框的模糊事件,在该事件中进行计算。计算正常…但值未分配给文本框

$('body')。在('blur','dispatchValue1',函数()上{
var dispatchValue=$('#dispatchValue1').val();
var bundleSize=$('#bundleSize1').text();
var nPieces1=dispatchValue*bundleSize;
$('#pieces1').val(nPieces1);
var ntotal=$('#total').text();
$('供应数量').val(总和);
如果(ntotal>0)
{
var ntotal=$('#total').val();
var sum=parseFloat(ntotal)+parseFloat(nPieces1);
$('#pieces1').val(总和);
$('总计').val(总和);
$('供应数量').val(总和);
}
其他的
{
var sum=parseFloat(nPieces1);
$('#pieces1').val(总和);
$('总计').val(总和);
$('供应数量').val(总和);
}
});
});
$(文档).ready(函数(){
$('#btnDispatch')。单击(函数(){
$('body').append('x调度警报此订单已调度。
确定'); $('#dataConfirmModal1').find('.modal body').text($(this.attr('data-confirm')); $('#dataConfirmModal1').modal({show:true}); }); $('body')。在('click','btnOk',function()上{ var url=“@url.Action(“index”)”; $(location.attr('href',url); }); $('body')。在('click','btnClose',函数()上{ var url=“@url.Action(“index”)”; $(location.attr('href',url); }); });
您能在这个代码块中调用警报吗

$('body').on('blur', '#dispatchValue1', function() {
        var dispatchValue = $('#dispatchValue1').val();
        alert(dispatchValue );
        var bundleSize = $('#bundleSize1').text();
        alert(bundleSize);
        var nPieces1 = dispatchValue*bundleSize;
        $('#pieces1').val(nPieces1);

我认为第二次时,其中一个警报值为null或空。请核对一下。你失去了对那片区域的控制。

是的,我已经把警报。。。显示正确值的警报。。。但无法分配到片段1文本框…可能第二次它没有进入模糊功能,是吗?模糊被调用…警报显示完美值…只有分配没有完成…如果文本框是这样的,它应该像你说的那样工作警报工作。您可以检查警报($(“#pieces1”).val()的警报;我看不到另一个失败。好吧,我会试试这段代码…但它第一次工作得很好,第二次也应该可以。。。不是吗?有任何实例问题吗?
$('body').on('blur', '#dispatchValue1', function() {
        var dispatchValue = $('#dispatchValue1').val();
        alert(dispatchValue );
        var bundleSize = $('#bundleSize1').text();
        alert(bundleSize);
        var nPieces1 = dispatchValue*bundleSize;
        $('#pieces1').val(nPieces1);