Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

C# and Return Datagrid Column Value

Posted on 2008-06-23
5
Medium Priority
?
509 Views
Last Modified: 2013-11-26
I have a Datagrid - dgSearchResults
I would like to return the value in the first column, MORTGEE_NUMBER

How can I do this via code?

Thanks,

JD
0
Comment
Question by:jamesdean666
  • 3
  • 2
5 Comments
 
LVL 16

Expert Comment

by:burakiewicz
ID: 21848308
dgSearchResults.Rows[x].Cells[0].Value

0
 
LVL 16

Expert Comment

by:burakiewicz
ID: 21848397
or do you need all of the values from the column
0
 

Author Comment

by:jamesdean666
ID: 21848528
Just one column in the row, which will be selected in the datagrid.
0
 
LVL 16

Accepted Solution

by:
burakiewicz earned 2000 total points
ID: 21848615
these should work then
dgSearchResults.SelectedRows[0].Cells[0].Value;  
or
dgSearchResults.Rows[dgSearchResults.SelectedRows[0].Index].Cells[0].Value;
you can also use the column name

dgSearchResults.SelectedRows[0].Cells["MORTGEE_NUMBER"].Value;  
or
dgSearchResults.Rows[dgSearchResults.SelectedRows[0].Index].Cells["MORTGEE_NUMBER"].Value;
0
 

Author Closing Comment

by:jamesdean666
ID: 31469854
Thanks.
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question