@if (SelectedProduct != null)
    {
        <SfDialog Width="1000px" Target="#target" IsModal="true" ShowCloseIcon="true" @bind-Visible="EnableEditForm">
            <DialogTemplates>
                <Header> @SelectedProduct.Name </Header>
                <Content>
                    <ProductForm Product="@SelectedProduct"></ProductForm>
                </Content>
            </DialogTemplates>
            <DialogButtons>
                <DialogButton Content="Close" IsPrimary="true" OnClick="@CloseEditForm" />
            </DialogButtons>
            <DialogAnimationSettings Effect="@DialogEffect.Fade"></DialogAnimationSettings>
        </SfDialog>
    }

                    <GridColumn HeaderText="" TextAlign="TextAlign.Center" Width="50">
                        <Template>
                            @{
                                var product = (context as Product);
                                <div class="btn-group">
                                    <SfButton title="Advance Edit" @onclick="@(e => OpenEditForm(product.GlobalId))"><i class="fa fa-edit"></i></SfButton>
                                </div>
                            }
                        </Template>
                    </GridColumn>
        string target { get; set; } = "#container";
        public bool EnableEditForm { get; set; } = false;
        public Product SelectedProduct { get; set; }
        public void OpenEditForm(string pGlobalId)
        {
            this.SelectedProduct = this.ProductList.Where(a => a.GlobalId == pGlobalId).FirstOrDefault();

            this.EnableEditForm = true;
        }

        public void CloseEditForm()
        {
            this.EnableEditForm = false;
        }
Last modified: February 6, 2021

Author

Comments

Write a Reply or Comment