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

ASP.NET and ComboBox value at PageLoad

0 Answers 102 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Erick
Top achievements
Rank 1
Erick asked on 09 May 2012, 08:31 PM
I'm using the Kendo ComboBox with an <asp:TextBox> and a DataSource which filters over about 6k records. Then the user chooses one value and saves it. When the page is loaded again, I need to bring the ComboBox populated with the choosen value. What I save is an Id (the dataValueField) but displaying a Name (the dataTextField, something really common).

I tried using $("#myField").data("kendoComboBox").value(myId) but it just shows this Id in the ComboBox span. If I search the Name and put it on my TextBox, the Name is shown nicely, but the value isn't assigned, what will cause problems if the users wants saving again.

It would be nice to do it the right way just with the Page_Load, and not forcing an Ajax request when the page comes to the user, which was the only way I can deal with it until now.

What is the right approach to bring the ComboBox filled with the desired value during my Page_Load, showing the Name as the current text but bringing also the Id to use as the current value of ComboBox?

No answers yet. Maybe you can help?

Tags
ComboBox
Asked by
Erick
Top achievements
Rank 1
Share this question
or