开发者

Adding a DataColumn to a DataTable

How do I go about adding a ButtonColumn to a DataTable.

I am basically using a DataTable as the DataSource of a DataGrid and need to add a ButtonColumn to the DataTable so that when I DataBind it to the DataGrid it all works.

Although when I try

dt.Columns.Add(buttonColumn)

This is not allowed. It has to be a basic DataColumn.

Thanks in advance, I know it's a simple q开发者_开发问答uestion so shouldn't be hard to answer.


You can't add a ButtonColumn to DataTables. Instead, you add the ButtonColumn to the DataGrid (front side or back side) and define its bind (with the DataField property) to a column in the DataTable.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜