我正在脚本中创建动态选择。
$.each(data, function (i) {
optionhtml = '<option value="'
data[i].CustomerId + '">' + data[i].CustomerId + ' _ ' + data[i].PurchaseDate + ' _ ' + data[i].SupplyDate + ' _ ' + data[i].SupplierName + '</option>';
$("select[id='ddlAdm" + arrElem[0]']").append(optionhtml);
});
Run Code Online (Sandbox Code Playgroud)
这很好用。选择在 CustomerId+PurchaseDate+SupplyDate+SupplierName 的下拉菜单中显示文本
但是我想为此在选择中添加标题。
CustomerId PurchaseDate SupplyDate SupplierName
123 10/11/2016 10/15/2018 XYZ
123 10/16/2018 10/23/2018 PQR
Run Code Online (Sandbox Code Playgroud)
我真的想为此跳过自动完成和预输入插件。需要在选择中添加标题。
我们正在开发一个Mvc应用程序,我们希望使用nInject来使用依赖注入.目前我们正在维护不同类库"ShopEntities"中的实体,而在我们的mvc应用程序中,我们正在使用这些实体.让我们考虑ShopEntities中的一个类.
namespace ShopEntities
{
public class Customers
{
public int custId {get;set;}
public string custName {get;set;}
public string Address {get;set;}
public string ShippingAddress {get;set;}
}
}
Run Code Online (Sandbox Code Playgroud)
现在,当我们想在我们的mvc应用程序中使用它时,我们创建一个实例并设置如下所示的属性,
public ActionResult Index()
{
ShopEntities.Customers cust = new ShopEntities.Customers();
cust.CustName = "Sam";
cust.IAddress = "xyz";
cust.ShippingAddress = "xyz xyx xyz";
}
Run Code Online (Sandbox Code Playgroud)
如何在这里使用nInject来避免依赖?此外,我们不希望创建接口,因为这在范围上是有限的.提前致谢.