Dynamically set the option values
I have 2 different lists: EmployeeNames and Names
I read the values in Names and that of EmployeeNames.

If EmployeeNames exists in Names, I must not add that value to "ToSelectBox" but to "FromSelectBox".

If EmployeeNames doesn`t exist in Names, I must add that value to "ToSelectBox" but not to "FromSelectBox".

How can I do that dynamically?

I have 2 option values as follows:

    <select id="fromSelectBox" multiple="multiple" > 
 
      <% foreach (var item in Model.EmployeeNames) { %> 
               <option value="<%=Html.Encode(Item.Text)%>"><%=Html.Encode(item.Text)%></option>  
            <%}  
        %> 
        </select> 


----------


    select id="ToSelectBox" multiple="multiple" > 
 
      <% foreach (var item in Model.Names) { %> 
               <option value="<%=Html.Encode(Item.Text)%>"><%=Html.Encode(item.Text)%></option>  
            <%}  
        %> 
        </select> 
Dynamically set the option values
===

I have 2 different lists: EmployeeNames and Names
I read the values in Names and that of EmployeeNames.

If EmployeeNames exists in Names, I must not add that value to "ToSelectBox" but to "FromSelectBox".

If EmployeeNames doesn`t exist in Names, I must add that value to "ToSelectBox" but not to "FromSelectBox".

How can I do that dynamically?

I have 2 option values as follows:

    <select id="fromSelectBox" multiple="multiple" > 
 
      <% foreach (var item in Model.EmployeeNames) { %> 
               <option value="<%=Html.Encode(Item.Text)%>"><%=Html.Encode(item.Text)%></option>  
            <%}  
        %> 
        </select> 


----------


    select id="ToSelectBox" multiple="multiple" > 
 
      <% foreach (var item in Model.Names) { %> 
               <option value="<%=Html.Encode(Item.Text)%>"><%=Html.Encode(item.Text)%></option>  
            <%}  
        %> 
        </select> 