How to bind data in Dropdown

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jay123
    New Member
    • Sep 2008
    • 121

    How to bind data in Dropdown

    Hello,
    I have a listview with two columns where Itemtemplate is
    Code:
    <ItemTemplate>
    	        <tr class="row1">
    	            <td><%#Eval("Name")%></td>									            
    	            <td>	               
    	                <asp:DropDownList runat="server" ID="DDL" Text='<%#Eval("ChildName")%>' />                                    
                    </td>
    	        </tr>
    	    </ItemTemplate>
    What i am unable to do here is Every 'Name' as have multiple 'ChildName' which i need to show in DropDown.

    How can i bind this data so for every row it comes as 'Name' followed by 'DropDown with child Name'

    my VB.Net code is like
    Code:
    Result = NameClass.GetData(Id)
    ListView.DataSource = Result            
    ListView.DataBind()
    above code doesnt work

    The data i am getting from DB is in 2 coloumns as
    Code:
    'Name' & 'Childname'
           ABC      efg
           ABC      xyx
    basically i need to iterate through each distinct Name and add childname as a listitem in a dropdown

    Can anyone point me in right direction, where to get started??

    Thanks in advance
    Jay
Working...