Reputation: 3568
What I want to do is to add a column that filled by checkboxes and placed on the left side of the grid. The grid rows is binding from a query. I have this code:
string query = "SELECT TransID, Company, Period, EmpID, Employee FROM Trx"
DataTable tblClaim;
tblClaim = DB.sql.Select(query);
tblClaim.Columns.Add("Process", typeof(bool)); //I want this column placed on the left side of the grid
gcxClaim.ExGridControl.DataSource = tblClaim;
What I get from that code is, the checkbox is disabled and the column is placed on the right side. While I tried to place tblClaim.Columns.Add("Process", typeof(bool));
before tblClaim = DB.sql.Select(query);
, it got error. How can I do that? Thanks.
Upvotes: 0
Views: 142
Reputation: 3568
It works by below code:
string query = "SELECT CAST(1 AS BIT) AS Process, TransID, Company, Period, EmpID, Employee FROM Trx"
tblClaim = DB.sql.Select(query);
gcxClaim.ExGridControl.DataSource = tblClaim;
gcxClaim.ExGridView.OptionsBehavior.Editable = true;
for (int i = 0; i < tblClaim.Columns.Count; i++)
{
gcxClaim.ExGridView.Columns[i].OptionsColumn.AllowEdit = false;
}
gcxClaim.ExGridView.Columns["Process"].OptionsColumn.AllowEdit = true;
Upvotes: 0
Reputation: 8960
Try this,
tblClaim.Columns.Add("Process", typeof(bool)).SetOrdinal(0);
This will set the index of column "Process" to 0
Upvotes: 1