DataGridView Link Cell
-
Hi All; I'm working in VS2005, and have a DataGridView that draws from a datasource. Is there a way to change a column to be a link style column after the DataGridView populates? Here's how I populate it:
DataSet ds = new DataSet(); dgvShipmentHistory.DataSource = null; SqlDataAdapter da = new SqlDataAdapter(mySQLClass.Query, mySQLClass.SqlCon); da.MissingSchemaAction = MissingSchemaAction.AddWithKey; da.Fill(ds, "ShipmentHistory"); dgvShipmentHistory.DataSource = ds.Tables[0]; dgvShipmentHistory.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
I want to be able to change one of the columns to be a link type column so that users can click the hyperlink and I can throw up a page. Thanks -
Hi All; I'm working in VS2005, and have a DataGridView that draws from a datasource. Is there a way to change a column to be a link style column after the DataGridView populates? Here's how I populate it:
DataSet ds = new DataSet(); dgvShipmentHistory.DataSource = null; SqlDataAdapter da = new SqlDataAdapter(mySQLClass.Query, mySQLClass.SqlCon); da.MissingSchemaAction = MissingSchemaAction.AddWithKey; da.Fill(ds, "ShipmentHistory"); dgvShipmentHistory.DataSource = ds.Tables[0]; dgvShipmentHistory.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
I want to be able to change one of the columns to be a link type column so that users can click the hyperlink and I can throw up a page. ThanksWindows or web?
Ketty
-
Windows or web?
Ketty
-
Did u try using DataGridViewLinkColumn? If ur grid id bound to datasource, goto properties -> Columns -> select the appropriate column from ur columns list -> and change ColumnType property Let me know if that works or am i thinking too simple. ;)
Ketty
-
Did u try using DataGridViewLinkColumn? If ur grid id bound to datasource, goto properties -> Columns -> select the appropriate column from ur columns list -> and change ColumnType property Let me know if that works or am i thinking too simple. ;)
Ketty
-
The only property I can see is the CellStyle property, I dont see a ColumnType property on the datagridview column.
-
The only property I can see is the CellStyle property, I dont see a ColumnType property on the datagridview column.
This is simple Designer generated code. How to reach that property. 1. Select ur DataGridView control on designer. 2. F4 3. Columns (collection) 4. Select 5 On right side u see all column properties. 6. Change ColumnType to DataGridViewLinkColumn
namespace WindowsApplication1 { partial class Form1 { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.actionTypesBindingSource = new System.Windows.Forms.BindingSource(this.components); this.fISM0702DataSet = new WindowsApplication1.FISM0702DataSet(); this.actionTypesTableAdapter = new WindowsApplication1.FISM0702DataSetTableAdapters.ActionTypesTableAdapter(); **this.actionTypeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewLinkColumn();** this.descriptionDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.actionTypesBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.fISM0702DataSet)).BeginInit(); this.SuspendLayout(); // // dataGridView1 // this.dataGridView1.AutoGenerateColumns = false; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGr
-
This is simple Designer generated code. How to reach that property. 1. Select ur DataGridView control on designer. 2. F4 3. Columns (collection) 4. Select 5 On right side u see all column properties. 6. Change ColumnType to DataGridViewLinkColumn
namespace WindowsApplication1 { partial class Form1 { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.actionTypesBindingSource = new System.Windows.Forms.BindingSource(this.components); this.fISM0702DataSet = new WindowsApplication1.FISM0702DataSet(); this.actionTypesTableAdapter = new WindowsApplication1.FISM0702DataSetTableAdapters.ActionTypesTableAdapter(); **this.actionTypeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewLinkColumn();** this.descriptionDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.actionTypesBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.fISM0702DataSet)).BeginInit(); this.SuspendLayout(); // // dataGridView1 // this.dataGridView1.AutoGenerateColumns = false; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGr