User483994611 posted
I have a grid clicking on edit button it will open a pop up where all text boxes and dropdown values will be pre populated and user can update</div> <div>The
ProductType dropdown is not populating the selected value which is in DB it is showing "Please Select" ...need help where i am doing wrong
editProduct(_product: Product) {
//Show edit dialog
this.displayEditDialog = true;
this.isEdit = true;
this.isAdd = false;
this.product = { Id: _product.Id, Name: _product.Name, Category: _product.Category, Price: _product.Price,ProductTypeId: _product.ProductTypeId };
}
<label class="col-md-1 control-label" style="width: 122px;" for="ProductTypeId">Product Type</label>
<div class="col-md-12">
<select class="form-control" formControlName="ProductTypeId" required [(ngModel)]="selectedProductType" (change)="onSelect($event)" >
<option value="undefined">Please select</option>
<option *ngFor="let producttype of producttypes"
[ngValue]="producttype.ProductTypeId">
{{producttype.ProductTypeName}}
</option>
</select>
onSelect(args) {
alert(args.target.value);
alert(args.target.options[args.target.selectedIndex].text);
this.selectedProducttype = args.target.value;
}