Add button column to datatable
13,606
Solution 1
Add Buttoncolumn in DataTable its wired ...thats not possible at all...
The DataTable DataColumn DataType property supports the following base .NET Framework data types:
- Boolean
- Byte
- Char
- DateTime
- Decimal
- Double
- Int16
- Int32
- Int64
- SByte
- Single
- String
- TimeSpan
- UInt16
- UInt32
- UInt64
Sample code to add coplumn
DataTable workTable = new DataTable("Customers");
DataColumn workCol = workTable.Columns.Add("CustID", typeof(Int32));
workCol.AllowDBNull = true;
Solution 2
You can add a button
only on DataGrid
not DataTable
.
Author by
user1292656
Updated on June 06, 2022Comments
-
user1292656 almost 2 years
I am trying to insert a button column into a datatable but it says that its an error. Any help pleasE?
ButtonColumn col = new ButtonColumn(); col.CommandName = "select"; col.ButtonType = ButtonColumnType.LinkButton; col.HeaderText = "Edit"; dt.Columns.Add(col);
-
Renatas M. about 12 yearsI think OP actually trying to add column to datagrid-datasource is datatable so that's why :)
-
Pranay Rana about 12 years@Reniuz - i m wating for the update from op side so that i can update my answer according to that...
-
Tim Schmelter about 12 yearsI'm missing
Byte[]
in the above list. msdn.microsoft.com/en-us/library/…