You can get/set TextBox value on WebCombo via client side. The value inside the TextBox portion is NOT the WebCombo's Text (DataTextField).
In this topic, you will learn how to use GetTextBoxValue and SetTextBoxValue methods.
To get/set the TextBox on WebCombo
- Drag a WebCombo instance into the WebForm.
- Drag a HTML button and leave the Id as it is, which is Button1.
- To get TextBox value of combo, double click the HTML button and add the following code in the defined client side event handler:
JavaScript Copy Code function Button1_onclick() { // Obtain WebCombo object var combo = ISGetObject("WebCombo1"); // Obtains the value inside the TextBox // portion of the WebCombo combo.GetTextBoxValue(); return true; }
- To set TextBox value of combo, double click the HTML button and add the following code in the defined client side event handler:
JavaScript Copy Code function Button1_onclick() { // Obtain WebCombo object var combo = ISGetObject("WebCombo1"); // Sets the value inside the TextBox // portion of the WebCombo combo.SetTextBoxValue("Please select the CustomerID"); return true; }
- Run the project.