Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add button column to datatable

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);
like image 710
user1292656 Avatar asked May 30 '26 11:05

user1292656


1 Answers

Add Buttoncolumn in DataTable its wired ...thats not possible at all...

The DataTable DataColumn DataType property supports the following base .NET Framework data types:

  1. Boolean
  2. Byte
  3. Char
  4. DateTime
  5. Decimal
  6. Double
  7. Int16
  8. Int32
  9. Int64
  10. SByte
  11. Single
  12. String
  13. TimeSpan
  14. UInt16
  15. UInt32
  16. UInt64

Sample code to add coplumn

DataTable workTable = new DataTable("Customers"); 
DataColumn workCol = workTable.Columns.Add("CustID", typeof(Int32));
workCol.AllowDBNull = true;
like image 161
Pranay Rana Avatar answered Jun 01 '26 23:06

Pranay Rana