Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. DataGridView Link Cell

DataGridView Link Cell

Scheduled Pinned Locked Moved C#
databasequestion
8 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rahvyn6
    wrote on last edited by
    #1

    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

    K 1 Reply Last reply
    0
    • R rahvyn6

      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

      K Offline
      K Offline
      Ketty Avashia
      wrote on last edited by
      #2

      Windows or web?

      Ketty

      R 1 Reply Last reply
      0
      • K Ketty Avashia

        Windows or web?

        Ketty

        R Offline
        R Offline
        rahvyn6
        wrote on last edited by
        #3

        Windows.

        K 1 Reply Last reply
        0
        • R rahvyn6

          Windows.

          K Offline
          K Offline
          Ketty Avashia
          wrote on last edited by
          #4

          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

          R 1 Reply Last reply
          0
          • K Ketty Avashia

            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

            R Offline
            R Offline
            rahvyn6
            wrote on last edited by
            #5

            The only property I can see is the CellStyle property, I dont see a ColumnType property on the datagridview column.

            R K 2 Replies Last reply
            0
            • R rahvyn6

              The only property I can see is the CellStyle property, I dont see a ColumnType property on the datagridview column.

              R Offline
              R Offline
              rahvyn6
              wrote on last edited by
              #6

              There is a DataGridViewLinkColumn class, but dont know if that will help me once the grid has been populated already, as I'm unsure how to change the type of column.

              1 Reply Last reply
              0
              • R rahvyn6

                The only property I can see is the CellStyle property, I dont see a ColumnType property on the datagridview column.

                K Offline
                K Offline
                Ketty Avashia
                wrote on last edited by
                #7

                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

                R 1 Reply Last reply
                0
                • K Ketty Avashia

                  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

                  R Offline
                  R Offline
                  rahvyn6
                  wrote on last edited by
                  #8

                  Yes, the grid is bound at runtime, so although I know what the columns will be for the most part, they could change.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups