0

大家好,我在文本框中正确显示数据时遇到问题这是我的 Print partialView

@{ Layout = null; }
@model Estudio.WebUI.Models.PrintViewModel
@using (Ajax.BeginForm("Print", new { @class = "openDialog data-dialog-id='PrintDialog' data-dialog-Title='Print'" }, new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "PrintDialog" }))
{
@Html.HiddenFor(m => m.FacturaId)
<div class="editor-label">
    @Html.LabelFor(m => m.NComprobante)
    <div class="editor-field">
        @Html.TextBoxFor(m => m.NComprobante)
    </div>
</div>
<br/>
<div class="editor-label">
    @Html.LabelFor(m => m.SendMail)
    <div class="editor-field">
        @Html.CheckBoxFor(m => m.SendMail)
    </div>
</div>
<input type="submit" name="Imprimir" value="Imprimir" id="Imprimir"/>

<script type="text/javascript">
    $(document).ready(function () {
        $("#NComprobante").mask("99999-999999999999");
    });
</script>    
}

这是 ActionResult 打印

   public ActionResult Print(string id)
    {
        ...
        var model = new PrintViewModel
                        {
                            FacturaId = factura.FacturaId,
                            NComprobante = numero[0] + "-" + comprabante.ToString("000000000000")
                        };
        return PartialView("Print", model);
    }

任何人都可以帮忙吗?

4

1 回答 1

0

错误的代码

NComprobante = numero[0] + "-" + comprabante.ToString("000000000000")

正确的是:

var comprabante = numero[0] + "-" + (Convert.ToDouble(numero[1]) + 1).ToString("0000000000000");
于 2013-01-31T17:17:55.303 回答