Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

How to embed drop down with Grid view in asp.net

I have a gridview containing data pouplated from table having 5 columns.
I want to add dropdown in 6th column, and textbox in 7th column.
<asp:Gridview id="g1" runat="server"/>
1 Solution
Tom BeckCommented:

<asp:GridView ID="g1" runat="server" AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="SqlDataSource1">
                <asp:BoundField DataField="id" HeaderText="Column 1" />
                <asp:BoundField DataField="randomData" HeaderText="Column 2" />
                <asp:BoundField DataField="sort" HeaderText="Column 3" />
                <asp:BoundField DataField="sort" HeaderText="Column 4" />
                <asp:BoundField DataField="sort" HeaderText="Column 5" />
                <asp:TemplateField HeaderText="Drop Down List">                            
                        <asp:DropDownList ID="ddlTest" runat="server">
                            <asp:ListItem Text="Item 1" Value="item_1"></asp:ListItem>
                            <asp:ListItem Text="Item 2" Value="item_2"></asp:ListItem>
                            <asp:ListItem Text="Item 3" Value="item_3"></asp:ListItem>
                            <asp:ListItem Text="Item 4" Value="item_4"></asp:ListItem>
                <asp:TemplateField HeaderText="Text Box Field">
                        <asp:TextBox ID="txtTest" runat="server" Text="text"></asp:TextBox>                                

Open in new window

searchsanjaysharmaAuthor Commented:

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now