How to get the Value of a Selected cell in DataGrid using c#(windows application)

Double click the DataGrid and write below code:


private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
button1.Text = dataGridView1.CurrentCell.Value.ToString();
}


Comments

Author: Raj06 Aug 2012 Member Level: Bronze   Points : 0

it does not work in asp.net. I ve mail id column in my gridview i want to display that mail address into particular text box. pls can anyone suggest me how can i do like that?

Author: Raj06 Aug 2012 Member Level: Bronze   Points : 2

I created one new website in asp.net using C#. In that i use gridview control .In that gridview i ve four columns namely Emp_id,Emp_Name,Emp_DOB and Emp_mail_id.By Used on grid view control i displayed thier details succesfully but i ve one problem i.e Based on thier Date Of Birth i ve to send greetings to that particular person's mail id when am press the send mail button. Can any one tell me how can i do like that? It is very urgent pls post u r ans as soon as possible.

Guest Author: shakeer08 Aug 2012

Hi Raj,
The above code works with Windows Application, Not ASP.NET



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: