如何在网格视图中添加文本框,ddl [英] How to add textbox,ddl in grid view
本文介绍了如何在网格视图中添加文本框,ddl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
海先生,
我可以知道如何在网格视图中添加文本框和下拉列表.请给我一个有效的例子.
谢谢,
stanly.
Hai sir,
May i know how to add the textbox and dropdownlist in grid view. Please wend me one valid example.
Thanks,
stanly.
推荐答案
使用TemplateFields.
http://msdn.microsoft.com/en-us/library/bb288031.aspx
Using TemplateFields.
http://msdn.microsoft.com/en-us/library/bb288031.aspx
您可以使用GridView模板字段添加TextBox或任何其他ASP.NET控件.
You can to use GridView Template Field for adding TextBox or any other ASP.NET Controls.
<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.
首先...您创建datagridviewTextBoxcolumn的对象,然后在datagridview中添加此对象控件.
..................................
first of all... you create the object of datagridviewTextBoxcolumn and then add this object control in the datagridview.
..................................
Dim txt As New DataGridViewTextBoxColumn()
DataGridView1.Columns.Add(txt)
txt.HeaderText = "Click Data"
txt.Text = "Click Here"
txt.Name = "btn"
txt.UseColumnTextForButtonValue = True
这篇关于如何在网格视图中添加文本框,ddl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文