开发者

Assignment Problem

开发者 https://www.devze.com 2022-12-14 18:04 出处:网络
my problem is that for some reason, a simple assignment isn\'t working. the dataGridView is binded to DB and im trying to assign a value type string to a column of type string

my problem is that for some reason, a simple assignment isn't working. the dataGridView is binded to DB and im trying to assign a value type string to a column of type string

enter code here //the initialization of the DataGridView     
   bindingSourceSchema.DataSource = null;
        dgwSchema.Columns["colID"].DataPropertyName = "APP_ID";
        dgwSchema.Columns["colName"].DataPropertyName = "DESCRIPTION";
        dgwSchema.Columns["colTextbox"].DataPropertyName = "APP_ARGS";
        dgwSchema.Columns["colTextbox"].HeaderText = "Parameters";          
        dgwSchema.Columns["colLink"].DataPropertyName = "APP_PATH";
        dgwSchema.Columns["colLink"].HeaderText = "Path";

        DataGridViewLinkColumn colLink = (DataGridViewLinkColumn)dgwSchema.Columns["colLink"];
        colLink.UseColumnTextForLinkValue = true;
        colLink.Text = "Edit";
        bindingSourceSchema.DataSource = SchemaDB.GetGenericApps();//the assignment
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                dgwSchema.Cur开发者_开发百科rentRow.Cells["colLink"].Value = openFileDialog.FileName;

                // !! ?? dgwSchema.CurrentRow.Cells["colLink"].Value STAYS with parameter "Edit"
            }

Thanks Eyal


It could be a problem with where you are running this code. Is this in the PageLoad event? Make sure the grid is not being bound again after you do this. What does the debugger show you if you put a break point after the assignment?


The reason is following property is set to true.

colLink.UseColumnTextForLinkValue = true;

Set it to false. Then it will resolve your problem.

0

精彩评论

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