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. .NET (Core and Framework)
  4. how to change DataGridViewLinkColumn text property forselected row only ??

how to change DataGridViewLinkColumn text property forselected row only ??

Scheduled Pinned Locked Moved .NET (Core and Framework)
tutorialcsharpdesignhelpquestion
2 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.
  • T Offline
    T Offline
    TARAK NATH ROY
    wrote on last edited by
    #1

    I have datagridview control and one of its column I hav added DataGridViewLinkColumn. If I click DataGridViewLink of any particular row of datagridview I want to change dynamicaly the Text property of DataGridViewLinkColumn for that Row only. my code is like this //I have set DataGridViewLinkColumn.Text="view" in design property DataGridViewLinkColumn.Text="view" //after clicking the link I want to change the text of link for that row only DataGridViewLinkColumn.CurrentRow.Cells[2].Value="hide" but problem is that text remain unchanged. I dont want "view" ,I want "hide" can any one guide me plz in c# and window application regards tarak

    J 1 Reply Last reply
    0
    • T TARAK NATH ROY

      I have datagridview control and one of its column I hav added DataGridViewLinkColumn. If I click DataGridViewLink of any particular row of datagridview I want to change dynamicaly the Text property of DataGridViewLinkColumn for that Row only. my code is like this //I have set DataGridViewLinkColumn.Text="view" in design property DataGridViewLinkColumn.Text="view" //after clicking the link I want to change the text of link for that row only DataGridViewLinkColumn.CurrentRow.Cells[2].Value="hide" but problem is that text remain unchanged. I dont want "view" ,I want "hide" can any one guide me plz in c# and window application regards tarak

      J Offline
      J Offline
      Jack Vanderhorst
      wrote on last edited by
      #2

      Try using the Value property of the cell instead of the Text property of the column. Maybe not the best answer, but it produces the behaviour I think you're after. Like so...

          private void Form1\_Load(object sender, EventArgs e)
          {
              DataGridViewLinkColumn col = new DataGridViewLinkColumn();
              dataGridView1.Columns.Add(col);
              for (int i = 0; i < 4; i++)
              {
                  DataGridViewRow dr = new DataGridViewRow();
                  dataGridView1.Rows.Add(dr);    
              }
              for (int i = 0; i < 4; i++)
                  dataGridView1.Rows\[i\].Cells\[0\].Value = "view";
          }
          
          private void dataGridView1\_CellClick(object sender, DataGridViewCellEventArgs e)
          {
              dataGridView1.Rows\[e.RowIndex\].Cells\[e.ColumnIndex\].Value = "hide";
          }
      
      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