Intersoft WebCombo Documentation
How-to: Set selected row in unbound WebCombo
See Also Send comments on this topic.
Intersoft WebCombo > WebCombo Features Overview > Unbound Mode How-to Topics > How-to: Set selected row in unbound WebCombo

Glossary Item Box

In WebCombo, you can set selected row in Unbound WebCombo from Client-side. 

This topic will show you how to set selected value from WebCombo on Client-side

To set selected value in WebCombo from Client-Side

  1. Go to HTML View and put the following code:

    <input id="Button1" type="button" value="SetValue" onclick="SetValue()" />

  2. Create function SetValue() in client side and add one of the these codes based on your need:

    JavaScript Copy ImageCopy Code
    function SetValue()
    {
       // To Set selected Value Directly
       var combo = ISGetObject("WebCombo1");
       combo.SetText("Brian");
       alert("Text set to Brian");
    }
    

    JavaScript Copy ImageCopy Code
    function SetValue()
    {                        
       // To Set selected Value by Index
       var combo = ISGetObject("WebCombo1");
       combo.SetSelectedIndex(2);
       alert("Set value by index 2");
    }
    

    JavaScript Copy ImageCopy Code
    function SetValue()
    {                        
       // To Set selected Value by KeyValue
       var combo = ISGetObject("WebCombo1");
       combo.SetSelectedRowByValue("Andrew");
       alert("Set value by KeyValue Andrew");
    }
    

    JavaScript Copy ImageCopy Code
    function SetValue()
    {                        
       // To Set selected Value by RowObject
       var combo = ISGetObject("WebCombo1");
       var rows = combo.GetRows();
       var row = rows[1];
       row.Select();
       alert("Set value by calling Select() method of a WebComboRow object");
    }   
    

  3. Run the project.

See Also