Subscribe to Subscribers
Talk to Webmaster Tony John

Resources » Code Snippets » DataGridView

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


Posted Date:     Category: DataGridView    
Author: Member Level: Gold    Points: 3



 


Double click the DataGrid and write below code:

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





Did you like this resource? Share it with your friends and show your love!


Responses to "How to get the Value of a Selected cell in DataGrid using c#(windows application)"
Author: Raj    06 Aug 2012Member 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: Raj    06 Aug 2012Member 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: shakeer     08 Aug 2012
Hi Raj,
The above code works with Windows Application, Not ASP.NET



Feedbacks      

Post Comment:




  • 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:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: GridView Edit Delete Update Functionality with some sample code
    Previous Resource: Print the DataGridView data using context menu
    Return to Resources
    Post New Resource
    Category: DataGridView


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    (No tags found.)
    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.