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.
精彩评论