本文介绍了如何在网格视图中添加文本框,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.
推荐答案
<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:DropDownList>
<asp:ListItem Text="text" />
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
在此处阅读有关TemplateField的信息 [ ^ ]
您可以在aspx中使用BindExpression绑定,也可以从后面的代码中使用FindControl来获取控件详细信息.
希望这会有所帮助.
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.
Dim txt As New DataGridViewTextBoxColumn()
DataGridView1.Columns.Add(txt)
txt.HeaderText = "Click Data"
txt.Text = "Click Here"
txt.Name = "btn"
txt.UseColumnTextForButtonValue = True
这篇关于如何在网格视图中添加文本框,ddl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!