Hi,
Its actually quite simple.....here are the steps:
1.
on the page codes behind (mypage.aspx.vb)
create a public varaiable.
Protected DropDownDataView As DataView = New DataView
Then create a function/sub that will load this dataview with data.
Private Sub LoadDropDownDataView()
Dim supplier As New VendimaxBOL.Supplier
Dim dt As DataTable
dt = supplier.SupplierGetAll
DropDownDataView = New DataView(dt)
End Sub
2.
In the (myPage.aspx), create teh desired column where the dropdown will
appear as a TemplateColumn
<asp:TemplateColumn HeaderText="Supplier">
<HeaderStyle ForeColor="White"></HeaderStyle>
<ItemStyle HorizontalAlign="Left"></ItemStyle>
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container,
"DataItem.supplier") %>'>
</asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp

ropDownList ID="ddlAddSuppliers" Runat="server"
DataTextField="SupplierName" DataValueField="ID"
DataSource="<%#DropDownDataView %>" CssClass="dropdown_medium">
</asp

ropDownList>
</FooterTemplate>
<EditItemTemplate>
<asp

ropDownList ID="ddlEditSuppliers" Runat="server"
DataTextField="SupplierName" DataValueField="ID"
DataSource="<%#DropDownDataView %>" CssClass="dropdown_medium">
</asp

ropDownList>
</EditItemTemplate>
</asp:TemplateColumn>
3. Now for the last part, when you go into edit mode, get the currently
selected item in the dropdown list to be autoselected
Private Sub dgProducts_EditCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
dgProducts.EditCommand
Me.dgProducts.EditItemIndex = e.Item.ItemIndex
'insert code to reload your datagrid here
Dim prod As New
myBOL.Product(Convert.ToInt32(CType(e.Item.Cells(0).Controls(1),
Label).Text))
Try
CType(dgProducts.Items(e.Item.ItemIndex).Cells(2).Controls(1),
DropDownList).SelectedValue = prod.SupplierID 'Sets the selected supplier
Catch ex As Exception
End Try
End Sub
Hope this helps!!!