Binding WebCombo Client Side

5 replies. Last post: January 2, 2014 9:32 PM by Yudi
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Simon DunnMember

I have been trying to bind a webcombo client side, as the other controls are all working client side and with it running server side I would lose other data.  I have given this a red-hot go and got it working for the initial load, but when the combo needs to be reloaded based on other changes on the page, and the second time around there are no "values" to retrieve.  


                    <td class="EditField" colspan="7">
                        <ISWebCombo:WebCombo ID="wcStock" runat="server" DataMember="Stock" DataValueField="ID" DataTextField="Description" UseDefaultStyle="true" DropDownRows="1000000" Width="232px" BindingOperationMode="ClientBinding">
                            <Columns>
                                <ISWebCombo:WebComboColumn BaseFieldName="Description" HeaderText="Stock" Name="Description" Width="200px" />
                                <ISWebCombo:WebComboColumn BaseFieldName="CategoryDescription" HeaderText="Category" Name="CategoryDescription" Width="120px" />
                                <ISWebCombo:WebComboColumn BaseFieldName="GroupDescription" HeaderText="Group" Name="GroupDescription" Width="120px" />
                                <ISWebCombo:WebComboColumn BaseFieldName="ID" Hidden="true" Name="ID" Bound="false" />
                            </Columns>
                            <LayoutSettings AlwaysShowHelpButton="false" ComboMode="MultipleColumns" AlwaysShowAllRowsOnDropdown="true">
                                <ClientSideEvents OnAfterItemSelected="wcStock_AfterItemSelected" />
                            </LayoutSettings>
                        </ISWebCombo:WebCombo>
                        <asp:RequiredFieldValidator ID="valReqStock" runat="server" ControlToValidate="wcStock" Display="Dynamic" ErrorMessage="Please select a stock item" ValidationGroup="valGrpItems" />
                    </td>

 

javascript to remove existing data and reload - this does as expected - rows are removed and new rows added, but the ID Value is not readable the second time through :>

function reloadStockItems (jsonItems)
{
    alert(jsonItems);
    var items = eval(jsonItems);
    
    var rows = purchaseOrder.wcStock.GetRows();
    for (var i = 0; rows[i] != null; i++)
    {
        rows.Remove(rows[i], true);
    }
    
    purchaseOrder.wcStock.Values = null;
    
    rows = purchaseOrder.wcStock.GetRows();
    for (i = 0; i < items.length; i ++)
    {
        var stock = items[i];
    
        stock = stock.split('|');
        var newRow = purchaseOrder.wcStock.NewRow(stock[0]);
        newRow.Value = stock[0];
        var cells = newRow.GetCells();
        cells.GetNamedItem("Description").Text = stock[1];
        cells.GetNamedItem("CategoryDescription").Text = stock[2];
        cells.GetNamedItem("GroupDescription").Text = stock[3];
        
        rows.Add(newRow);
    }
    purchaseOrder.wcStock.RefreshValueItems();    
    purchaseOrder.wcStock.UpdateUI();
        
}

 


function wcStock_AfterItemSelected(controlId)
{         
    purchaseOrder.wcStock.AddInput("SelectedSupplierValue", purchaseOrder.lstDDSupplier.getSelectedValue());
    purchaseOrder.wcStock.AddInput("SelectedStockValue", purchaseOrder.wcStock.Value);  // <----- problem occurs here in that the values are all set to 0.
    purchaseOrder.wcStock.SendCustomRequest();
    return true;
}

 

My main issue is that after the combo is reloaded - the second time through (and every time afterwards) the Value is set to 0;

Me second problem, which is unpretty, is that for every row added to the combo, the AfterItemSelected event gets fired, without selection occuring (is before it is finished rendeering)

Any help would be appreciated.

cheers

Simon
All times are GMT -5. The time now is 1:32 AM.
Previous Next