在数据网格的DataGridViewComboBoxColumn中设置默认值

编程入门 行业动态 更新时间:2024-10-26 08:23:21
本文介绍了在数据网格的DataGridViewComboBoxColumn中设置默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

你好, 我有一个数据网格,在那个数据网格中,有一个类型为DataGridViewComboBoxColumn的列.通过设计器,我可以在该combobox中添加元素.但是我想在那个combobox.me中显示默认值.我想在combobox中显示选择"作为默认值.我该怎么做? 请帮忙!

Hello , I have one datagrid,in that datagrid ,there is one column of type DataGridViewComboBoxColumn. through designer it is possible to me add element in that combobox.But i wants to display default value in that combobox.means i want to display "select" as default value in combobox.how can i do this? Please help!

推荐答案

像这样尝试: Try like this : ddlTest.DataSource = DataTable; ddlTest.DataTextField = "ID"; ddlTest.DataValueField = "Name"; ddlTest.DataBind(); ddlTest.Items.Insert(0, new ListItem("Select", "0"));

更多推荐

在数据网格的DataGridViewComboBoxColumn中设置默认值

本文发布于:2023-10-18 12:22:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1504220.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:网格   默认值   数据   DataGridViewComboBoxColumn

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!