Browse Source

databind the combo box controls

pull/182/head
Bill Wagner 7 years ago
parent
commit
f8264f6dea
2 changed files with 34 additions and 4 deletions
  1. +22
    -4
      src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx
  2. +12
    -0
      src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx.cs

+ 22
- 4
src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx View File

@ -36,13 +36,22 @@
<div class="row"> <div class="row">
<div class="col-md-12 form-group"> <div class="col-md-12 form-group">
<label class="control-label form-label" for="ItemBrand">Brand</label> <label class="control-label form-label" for="ItemBrand">Brand</label>
<asp:DropDownList ID="ItemBrand" runat="server" DataTextField="Brand" />
<asp:DropDownList ID="ItemBrand" runat="server"
ItemType="eShopOnContainers.Core.Models.Catalog.CatalogBrand"
SelectMethod="GetBrandsAsync"
DataTextField="Brand"
DataValueField="Id"
SelectedValue="<%# BindItem.CatalogBrandId %>" />
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12 form-group"> <div class="col-md-12 form-group">
<label class="control-label form-label" for="ItemType">Type</label> <label class="control-label form-label" for="ItemType">Type</label>
<asp:DropDownList ID="ItemType" runat="server" DataTextField="Type" />
<asp:DropDownList ID="ItemType" runat="server"
SelectMethod="GetTypesAsync"
DataTextField="Type"
DataValueField="Id"
SelectedValue="<%# BindItem.CatalogTypeId %>" />
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@ -86,13 +95,22 @@
<div class="row"> <div class="row">
<div class="col-md-12 form-group"> <div class="col-md-12 form-group">
<label class="control-label form-label" for="ItemBrand">Brand</label> <label class="control-label form-label" for="ItemBrand">Brand</label>
<asp:DropDownList ID="ItemBrand" runat="server" DataTextField="Brand" />
<asp:DropDownList ID="ItemBrand" runat="server"
ItemType="eShopOnContainers.Core.Models.Catalog.CatalogBrand"
SelectMethod="GetBrandsAsync"
DataTextField="Brand"
DataValueField="Id"
SelectedValue="<%# BindItem.CatalogBrandId %>" />
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12 form-group"> <div class="col-md-12 form-group">
<label class="control-label form-label" for="ItemType">Type</label> <label class="control-label form-label" for="ItemType">Type</label>
<asp:DropDownList ID="ItemType" runat="server" DataTextField="Type" />
<asp:DropDownList ID="ItemType" runat="server"
SelectMethod="GetTypesAsync"
DataTextField="Type"
DataValueField="Id"
SelectedValue="<%# BindItem.CatalogTypeId %>" />
</div> </div>
</div> </div>
<div class="row"> <div class="row">


+ 12
- 0
src/Web/Catalog.WebForms/Catalog.WebForms/EditCatalogItem.aspx.cs View File

@ -74,5 +74,17 @@ namespace eShopOnContainers.Catalog.WebForms
Response.Redirect("~"); Response.Redirect("~");
} }
} }
public async Task<IEnumerable<CatalogBrand>> GetBrandsAsync()
{
var brands = await catalog?.GetCatalogBrandAsync();
return brands.AsEnumerable();
}
public async Task<IEnumerable<CatalogType>> GetTypesAsync()
{
var types = await catalog?.GetCatalogTypeAsync();
return types.AsEnumerable();
}
} }
} }

Loading…
Cancel
Save