We help IT Professionals succeed at work.

Dynmically create dropdownlist inside gridview

itinfo7
itinfo7 used Ask the Experts™
on
I want to create dynamic dropdownlist inside Gridview control.
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" 
        CellPadding="4" ForeColor="Black" GridLines="Horizontal" Height="241px" 
        Width="374px">
            <Columns>
             
               
                <asp:TemplateField HeaderText="designation">
                    <ItemTemplate>
                        <asp:DropDownList ID="dd_desghnation" runat="server">
                            <asp:ListItem> --Select--</asp:ListItem>
                          
                        </asp:DropDownList>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
            <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
            <SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
        </asp:GridView>

Something like this...I don't know how can I do that....

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
IT Director
Commented:
You can use the visual studio control.  In design view click the tag on the upper eight of the grid.  Choose edit templates.  Choose the itrem you want and the view.  Delete the text box.  Drag a combobox from the tool bar into the view.  Bind it to the dataset field and choose items.