如何在C#中动态在datagridview中添加标签和单选按钮 [英] how to add label and radio button in datagridview dynamically in c#

查看:697
本文介绍了如何在C#中动态在datagridview中添加标签和单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在gridview中动态添加标签和单选按钮.我该怎么做.请帮助我进行开发.

i want to add label and radio button dynamically in gridview . how can i do this.please help me i m new in developing.

推荐答案

您需要使用模板字段. TemplateField对象使您可以指定包含标记和控件的模板,以自定义GridView控件中列的布局和行为.使用ItemTemplate,可以指定GridView在列中显示数据时要使用的布局.

在这里阅读所有内容:
MSDN:在GridView控件中使用TemplateFields [ MSDN:在GridView Web服务器控件中创建自定义列 [ MSDN:TemplateField.ItemTemplate属性 [ ^ ]

参考:
中的动态模板列ASP.NET 2.0 GridView控件 [
You need to use template fields. A TemplateField object enables you to specify templates that contain markup and controls to customize the layout and behavior of a column in a GridView control. Using an ItemTemplate, you can specify the layout to be used when the GridView displays data in a column.

Read all about it here:
MSDN: Using TemplateFields in the GridView Control[^]
MSDN: Creating a Custom Column in a GridView Web Server Control[^]
MSDN: TemplateField.ItemTemplate Property[^]

Refer:
Dynamic Template Columns in the ASP.NET 2.0 GridView Control[^]


这篇关于如何在C#中动态在datagridview中添加标签和单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆