Rownumber from DataRow

Posted on 2006-04-25
Last Modified: 2010-05-18
This is probably a fairly simple question which I cannot seem to recall the answer.  I have a Datarow which I have pulled from a datagrid by using the following command:

(dtInfoSchema is a datatable)
dr = dtInfoSchema.Rows.Find(obj);

What I would like to know is which row from within the datagrid this datarow was positioned at.  How can I find out which row number in the datagrid this row is positioned at?  I need to know so that I can make a specific cell active and selected at that row number.

Question by:gvector1
    1 Comment
    LVL 12

    Accepted Solution

    //Obtaining Current DataTable Row for a DataGrid

    < >

    // finding the index for a specific row  < from link below >

                    intRow = ds.Tables[0].DefaultView.Find(txtFindArg.Text);

    This link provides some good examples and complete info on getting the specific index of a datarow in a datatable

    <  >


    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Join & Write a Comment

    In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now