Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, November 22, 2024 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - Controls
Forum to discuss usage & tips for SalesLogix controls and other 3rd party ActiveX controls. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to Controls | New ThreadView:  Search:  
 Author  Thread: Select DataGrid Row Via Code - SLX 6.2.6
Yup.
Posts: 126
 
Select DataGrid Row Via Code - SLX 6.2.6Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Oct 12 1:37 PM
fiogf49gjkf0d

We have a datagrid and a hidden textbox on a tab of which the later is populated with the current OpportunityID, and has an OnChange event that triggers the population of the datagrid based on the OpportunityID.  We would like to automatically select the first row of the datagrid after population, but we are unable thus far.  First off, the datagrid's sortable property is currently set to false.  Some of threads here lead me to believe that this property should be set to true to accomplish this.  If that is the case, are there any negative implications to making that change?  Below is our first attempt, but we are not certain if we can reference the ID value of the row, or if a key value from within the row data needs to be referenced.


 


 


If grdProducts.Recordset.RecordCount > 0 Then
       grdProducts.Selection.Clear
       grdProducts.Selection.Add(1)

End If 


 

[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Select DataGrid Row Via Code - SLX 6.2.6Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Oct 12 3:37 PM
fiogf49gjkf0d
If you only want 1st row - take a look at slx_common (or util?) - there's a pre written function for that GetFirst row or similar.
[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Select DataGrid Row Via Code - SLX 6.2.6Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Oct 12 3:37 PM
fiogf49gjkf0d
If you only want 1st row - take a look at slx_common (or util?) - there's a pre written function for that GetFirst row or similar.
[Reply][Quote]
Yup.
Posts: 126
 
Re: Select DataGrid Row Via Code - SLX 6.2.6Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Oct 12 9:03 AM
fiogf49gjkf0d

I cannot locate such a function.  The bulk of the procedures in SLX_Common deal with items that are already selected, none of which seem to alter the selected items except for one function that removes the selected values.


 


I can see that the OnClick event for the datagrid performs the needed action, but I am not familiar with simulating events.

[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Select DataGrid Row Via Code - SLX 6.2.6Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Oct 12 9:33 AM
fiogf49gjkf0d

Create this. You can then pass in your grid and it will select the first row for you. This function comes into a later version - hence you can't find it.



 


<p>Sub SelectFirstRecordForGrid(aGrid)

 


    Dim blnSortable


 


    If aGrid.Recordset.RecordCount > 0 Then


       blnSortable = aGrid.Sortable


       aGrid.Sortable = False


       aGrid.Recordset.MoveFirst


       aGrid.Selection.Add aGrid.Recordset.Fields(aGrid.KeyField).Value


       aGrid.Sortable = blnSortable


    End If


End Sub


 



 


 

[Reply][Quote]
Yup.
Posts: 126
 
Re: Select DataGrid Row Via Code - SLX 6.2.6Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Oct 12 10:05 AM
fiogf49gjkf0d

Thanks, that is exactly what I was hoping to find. 

[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/22/2024 11:19:57 AM