Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8184921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:40:14+00:00 2026-06-07T01:40:14+00:00

I am listing a collection of date ranges (each date range is represented by

  • 0

I am listing a collection of date ranges (each date range is represented by a Period object) in a DevExpress XtraGrid (WinForms).

In a method which splits a Period in two (the split date is entered by the user), the code does this :

  1. Obtains a Period reference on the focused row. ((Period)GridViewPeriods.GetRow(selectedRows[0]);)
  2. Clones the selected period.
  3. Obtains a reference on the newly cloned Period.

After the job is done, I want to put the focus on the newly cloned Period. At this point, I only have my two Period references.

I haven’t found any method in the XtraGrid that could locate a row based on it’s value (like returning a RowHandle by passing an object).

I ended up writing this helper method :

    public int GetDataRowIndex(RatePeriod period)
    {
        int foundIndex = 0;

        for (int i = 0; i < GridViewRatePeriods.DataRowCount; i++)
        {
            if ((RatePeriod)GridViewRatePeriods.GetRow(i) == period)
            {
                foundIndex = i;
                break;
            }
        }
        return foundIndex;
    }

Then I set the focus on the newly created Period like this :

GridViewPeriods.FocusedRowHandle = GetDataRowIndex(tailingPeriod);

Is there any shorter or smarter way to do that ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T01:40:16+00:00Added an answer on June 7, 2026 at 1:40 am

    It looks like you are doing it the best way though it seems like you are having to go through a bunch of stuff to get what you are looking for Dev Express has the same solution as you have

    http://www.devexpress.com/Support/Center/p/A1488.aspx

    I thought maybe the rowindex could be related back to the order of your datasource but there does not appear to any collation

    http://www.devexpress.com/Support/Center/p/A1488.aspx

    If you are displaying any kinda unique identifying infomation in a single cell you might be able to use LocateByValue if you were not displaying the unique identifying infomation you could always hide that column

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Listing a id of items in a table which looks like: <g:sortableColumn style=width: 20px
I have a product listing, in which the title of the product is written.
I'm listing the data from one of my models in a table <% @events.each
My site has several listing pages and on each page, I'd like to enable
I have a Toolbar whose ItemSource is a collection of toolbarItems which contain the
I'm using MongoDB and need to remove duplicate records. I have a listing collection
I have a XPO domain object Order which has a association with OrderLine. In
If I want to bind a collection to a some form of listing control
I am listing students at my web page. I want to list their information
I have a table listing (gameid, playerid, team, max_minions) and I want to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.