Learn how to a build a cloud-first strategyRegister Now

x
  • 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"/>
0
searchsanjaysharma
Asked:
searchsanjaysharma
1 Solution
 
Tom BeckCommented:

<asp:GridView ID="g1" runat="server" AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="SqlDataSource1">
            <Columns>
                <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">                            
                    <ItemTemplate>
                        <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:DropDownList>                                
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Text Box Field">
                    <ItemTemplate>
                        <asp:TextBox ID="txtTest" runat="server" Text="text"></asp:TextBox>                                
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>

Open in new window

0
 
searchsanjaysharmaAuthor Commented:
tHANX
0

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