我试图通过Url.Action发送多个参数.
$('#dialog').dialog({ autoOpen: false,width: 850,height: 420,resizable: false,title: 'Vehicle details',modal: true,open: function (event,ui) { $(this).load("@Url.Action("LightStoneRequest",new { registrationNumber = Model.VehicleRegistration,vinNumber = Model.vVinNumber })"); },buttons: { "Close": function () { $(this).dialog("close"); } } });
在运行时,它看起来如下:
$(this).load("/APQuotes/LightStoneRequest?registrationNumber=TE5TGP&vinNumber=VINTEST44889856");
正如你所看到的,有一个vin号通过,但它在我的控制器中为null.
这是我的模态.
public partial class LightStoneRequest { public LightStoneRequest() { this.LightStoneDataFields = new HashSet<LightStoneDataField>(); } public int LightStoneRequestId { get; set; } public string RegistrationNumber { get; set; } public string VinNumber { get; set; } public virtual ICollection<LightStoneDataField> LightStoneDataFields { get; set; } }