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 - SalesLogix .NET Extensions
Forum to discuss the use of .NET Extensions in SalesLogix version 7 and higher. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix .NET Extensions | New ThreadView:  Search:  
 Author  Thread: Bind datagrid to a table perhaps using sublogix
Jay
Posts: 6
 
Bind datagrid to a table perhaps using sublogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Aug 12 3:52 AM
fiogf49gjkf0d

Hello,
I am creating a .net extension via vb. How can I bind a datagrid to a specific table I have created in slx database manager? Lets say this table is called xyz which is under Contact. Is this possible with sublogix?


Private Sub UserControl1_SalesLogixRecordChanged(CurrentID As String) Handles MyBase.SalesLogixRecordChanged        
Dim repo = New Repository(SlxApplication.ConnectionString)
        DataGridView1.DataSource = ?
End Sub

Sorry for asking this but I am still new to slx and vb. For any help I would be very thankful.


Thank you in advance!
Jay

[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Bind datagrid to a table perhaps using sublogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Aug 12 11:07 AM
fiogf49gjkf0d

Jay, 


You absolutely can bind a Sublogix entity list to a datagrid in a .NET Extension. This is an example that would bind all contacts for a particular account to a grid, where the account ID is the Current ID passed into the .NETExtensionHelper event (sorry, I don't know VB syntax)


 


private void UserControl1_SalesLogixRecordChanged(string CurrentID)
{
var repo = New Repository(SlxApplication.ConnectionString);
var contacts = repo.Find<Contact>(x => x.Accountid == CurrentID);
DataGridView1.DataSource = contacts;
}

 


Make sense?


Or if the Linq expression makes it hard to understand (or to translate back to VB), you can also do it like this:


 


private void UserControl1_SalesLogixRecordChanged(string CurrentID)
{
var repo = New Repository(SlxApplication.ConnectionString);
var contacts = repo.Select<Contact>()
.Where("AccountId", Operator.Equals, CurrentID)
.OrderBy("LastName", OrderByDirection.Ascending) //this line optional
.Execute();
DataGridView1.DataSource = contacts;
}

 

[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 4:03:05 AM