Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Windows Application
hai,
already created datagrid view in windows application ,and i create one field dynamically named"Send ",the column have only hyperlink created dynamically
click the hyperlink ("wishsend") to send email,plz helpme
Posted 26-Dec-12 0:49am
Edited 26-Dec-12 0:51am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

First add a link column in your datagridveiw code is

 
      DataGridViewLinkColumn links = new DataGridViewLinkColumn();
            links.HeaderText = "Hello";
            links.UseColumnTextForLinkValue = true;
            links.Text = "Email me";
            links.ActiveLinkColor = Color.White;
            links.LinkBehavior = LinkBehavior.SystemDefault;
            links.LinkColor = Color.Blue;
            links.TrackVisitedState = true;
            links.VisitedLinkColor = Color.YellowGreen;
            dataGridView1.Columns.Add(links);
 
then Find necessary value with this event
 
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString() == "Email me")
            {
                MessageBox.Show(dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString());
            }
            else
            {
                MessageBox.Show("You Clicked another Cell");
            }
        }
 
may be this will help you.
  Permalink  
Comments
mbsaravanan at 27-Dec-12 1:59am
   
but the control not enter in "dataGridView1_CellContentClick",plz help me
or send ur mail id i will send the screen shot ,plz my id :mbsaravanan@rediffmail.com
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

You can Use CellClick event
 
private void dataGridView1_CellClick_1(object sender, DataGridViewCellEventArgs e)
       {
           //dataGridView1.GetCellCount(DataGridViewElementStates.Selected);
           if (dataGridView1.CurrentCell.Value.ToString()== "Email me")
           {
           //if (dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString() == "Email me")
           //{
               MessageBox.Show(dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString());
           }
           else
           {
               MessageBox.Show("You Clicked another Cell");
           }
       }
Please let me know if this help you ... Smile | :)
  Permalink  
Comments
jibesh at 30-Dec-12 5:45am
   
do not post its as second solution, you can edit your solution using 'improve solution' if you want to update your solution.
Ronjon1 at 30-Dec-12 5:58am
   
got it thanks....
jibesh at 30-Dec-12 5:58am
   
you welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web03 | 2.8.140709.1 | Last Updated 30 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid