Problems when adding Dialog Mode data to grid

hello.

When adding data to the grid, I am adding it in Dialog Mode.

The added window is created as a template and a custom TextBox is used.

However, when you enter and save the data, the entered data is not received properly and an error occurs when saving to the db.

It seems to work fine if I use the default TextBox... Please help me figure out what's wrong with the code.스크린샷 2024-04-12 165614.png


Attachment: source_3fae473c.zip

1 Reply 1 reply marked as answer

PS Prathap Senthil Syncfusion Team April 15, 2024 10:00 AM UTC

Hi cho gyeong ho,

Based on the reported problem of 'data not being properly received and an error occurring when saving to the database upon entering and saving,' we have made modifications to the code below to resolve the issue. Please refer to the modified code snippet and sample provided for your reference.

//SorTextBox.Razor

<SfTextBox @ref="TextBoxObj"

           Type="@_type"

           Readonly="@_readonly"

           Created="@OnCreateGubun"

           Value="@p_Value"

           Width="80%"

           Input="@p_InputHandler"

           ValueChanged="@p_ValueChanged"

           ShowClearButton="@_ShowClearButton"

           @onkeypress='@(e => KeyPressed(e))'

           >

</SfTextBox>

   [Parameter]

   public string p_Value

   {

       get => _value;

       set

       {

           if (!EqualityComparer<string>.Default.Equals(value, _value))

           {

               _value = value;

               p_ValueChanged.InvokeAsync(value);

           }

       }

   }



Index.Razor

    <SfGrid @ref="Grid_Detail" DataSource="@code_Detail" AllowPaging="true" Height="500" Width="1000" Toolbar=@(new List<string>{"Add","Edit"}) AllowSorting="false"  GridLines="GridLine.Vertical"

            AllowFiltering="false" AllowGrouping="false" ShowColumnChooser="true" AllowReordering="true">

 

    <GridEvents OnActionComplete="ActionComplete" OnActionBegin="ActionBegin" TValue="Code"></GridEvents>

        <GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true"  Mode="EditMode.Dialog" >

          

            <Template>

                @{

                    var code = (context as Code);

                    <div>

                        <div class="form-row">

                            <div class="form-group col-md-6" style="float:left;">

                                <label class="e-float-text e-label-top">코드 No</label>

                            <SorTextBox @bind-p_Value="@(code.codeCD)" ></SorTextBox>

                            </div>

                            <div class="form-group col-md-6" style="float:right;">

                                <label class="e-float-text e-label-top">코드명</label>

                            <SorTextBox @bind-p_Value="@(code.codeNM)"></SorTextBox>

                            </div>

                        </div>

                        <div class="form-row">

                            <div class="form-group col-md-6" style="float:left;">

                                <label class="e-float-text e-label-top">코드값</label>

                            <SorTextBox @bind-p_Value="@(code.codeVal)"></SorTextBox>

                            </div>

                            <div class="form-group col-md-6" style="float:right;">

                                <label class="e-float-text e-label-top">순번</label>

                                <SfNumericTextBox ID="txt_code_sort" @bind-Value="@(code.code_sort)" TValue="int?"></SfNumericTextBox>

                            </div>

                        </div>

                        <div class="form-row">

                            <div class="form-group col-md-6" style="float:left;">

                                <label class="e-float-text e-label-top">예비문자 1</label>

                            <SorTextBox @bind-p_Value="@(code.etc_Str1)"></SorTextBox>

                            </div>

                            <div class="form-group col-md-6" style="float:right;">

                                <label class="e-float-text e-label-top">예비문자 2</label>

                            <SorTextBox @bind-p_Value="@(code.etc_Str2)

    </SfGrid>

 


Sample Link: https://blazorplayground.syncfusion.com/rthJNzsIhvgqwUzy

Regards,
Prathap S


Marked as answer
Loader.
Up arrow icon