how to change datagridview column type as programmatically after binding

820 Views Asked by At

I bound the list of string datasource to the gridview,Then i tried to change those to DataGridViewLinkCell but it's not reflect on the gridview.

public ExpandReport(String operation,List<string> dataSource,string companyCode,string DBName, string DType)
        {
            try
            {
                InitializeComponent();
                this.ex_dataGridView.DefaultCellStyle.Font=new Font("Verdana", 8);
                ex_linkLabel.Text = operation;
                filteredResult = dataSource;
                ex_dataGridView.DataSource = dataSource.ConvertAll(x => new { Value = x });
                company_Code = companyCode;
                DB_Name = DBName;
                D_Type = DType;

                if (DType.Equals("QT"))
                {
                    foreach (DataGridViewRow row in ex_dataGridView.Rows)
                    {
                        DataGridViewLinkCell linkCell = new DataGridViewLinkCell();
                        linkCell.Value = row.Cells[0].Value;
                        row.Cells[0] = linkCell;
                    }
                }
            }
0

There are 0 best solutions below