Grid using tag helpers in asp.net core

1 Answer 82 Views
DropDownList Grid
Rajesh
Top achievements
Rank 1
Iron
Rajesh asked on 25 Jul 2023, 04:36 AM | edited on 26 Jul 2023, 07:40 PM

I am using a drop down list in column template inside a grid..I could save sucessfully but when i click on edit the dropdown losses its bind.Can any one help  with what i am missing

   <kendo-dropdownlist name="Team"
                                        datatextfield="Team"
                                        datavaluefield="TeamID" data-bind="value:Team">
                        <datasource>
                            <transport>
                                <read url="@Url.Action("Teams_Read", "Grid")" />
                            </transport>
                        </datasource>
                    </kendo-dropdownlist>

 

i chnaged name of the dropdown to the value of what i wante dto bind but it didnt work.

1 Answer, 1 is accepted

Sort by
0
Accepted
Vasko
Telerik team
answered on 28 Jul 2023, 06:09 AM

Hi Rajesh,

I would initially like to acknowledge the fact that you have taken the extra time and effort to further provide the relevant DropDownList TagHelper editor that is currently held on your premises. I really appreciate it.

Based on a previous communication of yours, I presume that the current scenario in which the DropDownList resides is within the boundaries of a given column's editor template. Are my suppositions correct?

If this is the case, then the reason for the sporadical behavior would most notably be caused by a disparity between the "datavaluefield" TagHelper attribute of the DropDownList, and the "Team" column's annotation. Taking this factor into consideration, a possible recommendation would be to alter the column declaration in the following manner:

<columns>
    <column field="Team" width="250">
        <column-editor-template>
            <kendo-dropdownlist name="Team"
                                datatextfield="Team"
                                datavaluefield="Team" data-bind="value:Team">
                <datasource>
                    <transport>
                        <read url="@Url.Action("Teams_Read", "Home")" />
                    </transport>
                </datasource>
            </kendo-dropdownlist>
        </column-editor-template>
    </column>
</columns>

This should then produce the following visual representation upon the instantiation of editing operations:

For your convenience, I have also altered the sample from the aforementioned linked forum case for you to observe additionally.

Please let me know if this helps resolve the issue.

Kind Regards,
Vasko
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.
Tags
DropDownList Grid
Asked by
Rajesh
Top achievements
Rank 1
Iron
Answers by
Vasko
Telerik team
Share this question
or