Click here to Skip to main content
15,891,597 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai sir,
May i know how to add the textbox and dropdownlist in grid view. Please wend me one valid example.
Thanks,
stanly.
Posted

 
Share this answer
 
Comments
Uday P.Singh 28-Aug-11 8:25am    
my 5!
RaisKazi 28-Aug-11 8:40am    
Thanks Uday.
You can to use GridView Template Field for adding TextBox or any other ASP.NET Controls.

XML
<asp:GridView ID="GridView1" runat="server">
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:DropDownList>
                        <asp:ListItem Text="text" />
                    </asp:DropDownList>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>


Read Here About TemplateField[^]

You can Bind the using BindExpression in aspx or you can using FindControl from code behind to get the control details.

Hope this will help.
 
Share this answer
 
Comments
Uday P.Singh 28-Aug-11 8:25am    
my 5!
RaisKazi 28-Aug-11 8:41am    
Worth 5!
first of all... you create the object of datagridviewTextBoxcolumn and then add this object control in the datagridview.
..................................
VB
Dim txt As New DataGridViewTextBoxColumn()
        DataGridView1.Columns.Add(txt)
        txt.HeaderText = "Click Data"
        txt.Text = "Click Here"
        txt.Name = "btn"
        txt.UseColumnTextForButtonValue = True
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900