Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concat dropdownlist values into a comma separted string

Status
Not open for further replies.

dodge20

MIS
Jan 15, 2003
1,048
US
I have a gridview that has a dropdown list in each row. The dropdowns are named ur1,url2,url3 etc.
I would like to combine the selected values of all those dropdowns into a comma separted list and store it in a hidden field.

Code:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource1">
            <Columns>
                <asp:BoundField DataField="ProductName" HeaderText="Columns" 
                    SortExpression="ProductName" />
                <asp:TemplateField AccessibleHeaderText="MapTo" HeaderText="MapTo">
                   <ItemTemplate>
                     <select name='URL<%# Container.DataItemIndex + 1 %>' onchange='update_selection(this);'>
     <option value=''>Select a Continent</option>
      <option value='North America'>North America</option>
      <option value='South America'>South America</option>
      <option value='Africa'>Africa</option>
      <option value='Europe'>Europe</option>
      <option value='Asia'>Asia</option>
      <option value='Australia'>Australia</option>
    </select>
                    </ItemTemplate>

                </asp:TemplateField>
            </Columns>
        </asp:GridView>

Any help is appreciated.

Dodge20
 
You could call an onchange() javacript function on each of the ddls you want to capture data from.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top