This is a migrated thread and some comments may be shown as answers.

Get DataTextField on Client

1 Answer 96 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Iron
Veteran
Iron
Dave asked on 08 Sep 2020, 01:15 PM

Hi,

On the client, is there a way to get the value of the DataTextField used for binding?   The RadComboBox client object has a property _dataTextField, but this is always empty.

Thanks,

Dave

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Vessy
Telerik team
answered on 11 Sep 2020, 10:45 AM

Hi Dave,

The _dataTextField property returns a value only if the ComboBox is bound on the client-side. If you are binding it on the server-you can keep the value of the DataTextField into a hidden field on the page, accessing its value directly when needed.

        <telerik:RadComboBox ID="RadCombobox1" runat="server"></telerik:RadComboBox>
        <asp:HiddenField ID="HiddenField1" runat="server" />

        RadCombobox1.DataTextField = "TextFieldName";
        HiddenField1.Value = "TextFieldName";
        ...

And when you need this value on the client-side:

            function accessTextField() {
                var dataTextFiel = $get("HiddenField1").value;
            }

Regards,
Vessy
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
ComboBox
Asked by
Dave
Top achievements
Rank 1
Iron
Veteran
Iron
Answers by
Vessy
Telerik team
Share this question
or