web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Ax2009 EP - how to set focus on specific row ?

(0) ShareShare
ReportReport
Posted on by 1,535

Is it possible to set focus on specific row on dynamics:AxGridView ? I want to display all rows in AxGridView but set focus (highlight) on specific row, for example first row in my criteria.

For example I want to see rows from CustTable, and select first row with CustGroup >=20

 

AccountNum Name CustGroup
1101 Forest Wholesales 10
1102 Sunset Wholesales 10
1103 Cave Wholesales 10
1104 Desert Wholesales 20
1201 Sparrow Wholesales 20
1202 Owl Wholesales 10
1203 Pelican Wholesales 20

(In my example I want to start page with selected row for AccountNum=1104)

 

Regards

*This post is locked for comments

I have the same question (0)
  • Meyyappan Meenakshisundaram Profile Picture
    on at

    You should set the selectedindex of the record. But if the grid is paginated, then only the first page records will be returned. So you can only loop through those records and set the selectedindex for the record if found. The other option would be to not enable paging and go through the returned records , loop through and find the matching one and set the selected index.

     

    Thanks

    Mey

  • Ireneusz Smaczny Profile Picture
    1,535 on at

    Hi,

    Could you give me simple example for grid without paging with loop and how to set the selected row ?

     

    Regards

  • Meyyappan Meenakshisundaram Profile Picture
    on at

    Search on the web for any asp.net gridview solution. This is not specific to EP

     You have to write code in the RowDataBound event,

    get the GridViewRow object and inspect the cells for the column that you are looking for and set the selected index

    for (int i = 0; i < axGrid.PageSize; i++)

     {

     GridViewRow gRow =axGrid.Rows[i];

     if (gRow != null)

     {

     if (gRow.Cells[columnposition].Text == fieldValue)

     {

     axGrid.SelectedIndex = i;

     return;

     }

     }

     }

  • Ireneusz Smaczny Profile Picture
    1,535 on at

     THX a lot. Now it's work !

  • Community Member Profile Picture
    on at

    Is there a solution if I want to set focus on the first record after page changed? Currently I do have the problem that on the last pase there is only 1 record left and I am not able to select this one

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans