Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Updated 26-Dec-12 0:51am
v2

 
Share this answer
 
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

C#
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.
 
Share this answer
 
Comments
mbsaravanan 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
You can Use CellClick event

C#
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 ... :)
 
Share this answer
 
Comments
Jibesh 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 30-Dec-12 5:58am    
got it thanks....
Jibesh 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900