开发者

Problem in creating different types of columns in a Winforms gridview

开发者 https://www.devze.com 2022-12-23 05:08 出处:网络
My windows form application has a grid view control with filename as a default column. User should create a column of following types

My windows form application has a grid view control with filename as a default column. User should create a column of following types

Text, Number, Currency,

Combo Box, Check Box, Radio Button ,

Date time type (should display DateTimePicker control) and Hyper Link type.

After that i want to pass all rows to next screen for further processing. We can create a column of these types in a grid view but how can i store it in a data table so that i can pass it to next screen.

Or should i create a column in a data table and then assign data table to gr开发者_StackOverflow社区id view by

gridview.DataSource = dt; but can we create a these types of columns in a data table.


I don't quietly understand what's the problem is?

You need to create clumns in a grid and corresponding columns in a dataTable.

I use dataTableInstance.Columns.Add("ColumnName", typeof(DataType)); for data tables and for grid i use

SomeFieldType field = new SomeFieldType();
field.DataField = "ColumnName"; // Same as above, in dataTableInstance
gridInstance.Columns.Add(field);

When data binding should be done: gridInstance.DataSource = dataTableInstance;

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号