Using two combo box

1 posts, 0 answers
  1. Vijayaragavan
    Vijayaragavan avatar
    12 posts
    Member since:
    May 2009

    Posted 28 Jun 2010 Link to this post

    Hi

          Am using two Combo box inside a repeater control.
          The first combobox is multi selectable.
          When I select a value in first combo box, it will give a return field.
          And this return field should be the made available in the second combo box.

          Can you suggest me to solve this?

         Please see the code below

    ASPX:

    <asp:Repeater ID="repLineDetDistItems" OnItemDataBound="repLineDetDistItems_ItemDataBound" runat="server">
    <HeaderTemplate>
    <tr>
    <td><asp:Label runat="server" ID="lblbProNum" Text="~Proj_No~"></asp:Label></td>
    <td><asp:Label runat="server" ID="Label42" Text="~WO~"></asp:Label></td>
    </tr>
    </HeaderTemplate>

    <ItemTemplate>
    <td>
        <searchpicker:SearchPicker ID="col1" runat="server"   
               SearchPickerType="ProjNumberLineNumberMultiFields2Selection" />
    </td>
    <td>
        <searchpicker:SearchPicker ID="col2" runat="server"   
               SearchPickerType="ProjNumberLineNumberMultiFields2Selection" />
    </td>

    c#

    ((SearchPicker)e.Item.FindControl("col1")).ReturnFields = ((SearchPicker)e.Item.FindControl("col1")).ClientID;

    ((SearchPicker)e.Item.FindControl("col2")).ComboBox.Text = ((SearchPicker)e.Item.FindControl("col1")).Text;
    ((SearchPicker)e.Item.FindControl("col2")).Value = ((SearchPicker)e.Item.FindControl("col1")).Text;

    also used another method:

    Given a hidden text box, and i have set the value for this is return field of 1 column
    and on text change event of this hidden text box, written this JS as below

    function show(col1, col2) {
                debugger;
                var ctrl = col2;
                ctrl.set_text = col1.value;
                ctrl.set_value = col1.value;
                //col2.value = col1.value;
            }





Back to Top