Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, June 28, 2025 
 
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!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: Help with dynamicaly populating listbox
Brian Segers
Posts: 69
 
Help with dynamicaly populating listboxYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Feb 08 3:10 PM
On form load and when fields are changed I need to dynaicaly populate 3 list boxes.
Below is my code form the lan client. I cant think of where their may be an example in the OOTB client.

Thanks, Brian

START SAMPLE
Sub aceClassExitControl(Sender)

Dim strSQL
Dim objCon
Dim objRS
Dim intCount

set objCon = Application.GetNewConnection

' strSQL = "SELECT TOP 1 ITEMID FROM QUOTE_ITEM "
strSQL = "SELECT ITEMID FROM ITEM "
strSQL = strSQL & "WHERE ITEM_LEVEL = '" & aceLevel.Text & "' "
strSQL = strSQL & "AND ITEM_FAMILY = '" & aceFamily.Text & "' "
strSQL = strSQL & "AND ITEM_CLASS = '" & aceClass.Text & "' "
'Do not work in MSDE strSQL = strSQL & "AND rownum = 1 "

set objRS = objCon.Execute(strSQL)
intCount = objRS.RecordCount
If intCount <> 0 then
txtFCSItemID.Text = objRS.Fields("ITEMID").Value
Else
MsgBox "Invalid selections. Please try again."
aceLevel.Text = ""
aceFamily.Text = ""
aceClass.Text = ""
aceLevel.SetFocus
End If
objRS.Close
set objRS = Nothing
objCon.Close
set objCon = Nothing

End Sub

END SAMPLE
[Reply][Quote]
RJ Eaton
Posts: 234
 
Re: Help with dynamicaly populating listboxYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Feb 08 5:55 AM
I don't see anywhere your adding the items to the control..

There is an item.add("thisiswhatyouradding") for the control, try that

[Reply][Quote]
Mark Dykun
Posts: 297
 
Re: Help with dynamicaly populating listboxYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Feb 08 8:22 AM
Hey Brian,

Ok, so first you have your comboboxes that are hosted on your smart parts. These comboboxes have an onchange action that you can associate some body of work to. So on the controlling combobox add a change action c#. What this will do is embed the code into the smart part. You can then refer to the other child controls by name. When the change occurrs on the control you can update the list associated with the target control. The easies example would be

targetControl.Items.Clear();
targetControl.Items.Add("Item 1");
targetControl.Items.Add("Item 2");

now since you want to populate the list based on the database I would more then likely do something like;

protected void Type_ChangeAction(object sender, EventArgs e) {
Sage.Platform.Data.IDataService _dataService = ParentWorkItem.Services.Get();
System.Data.DataTable table = new System.Data.DataTable();
string sql = "Select Account from Account where Account like 'AB%'";
using (System.Data.OleDb.OleDbConnection conn = (System.Data.OleDb.OleDbConnection)_dataService.GetConnection())
{
conn.Open();
System.Data.OleDb.OleDbDataAdapter adapter = new System.Data.OleDb.OleDbDataAdapter(sql, conn);
adapter.Fill(table);
}

choiceCombo.DataTextField = "Account";
choiceCombo.DataValueField = "Account";
choiceCombo.DataSource = table;
choiceCombo.DataBind();
}


Mark

[Reply][Quote]
Brian Segers
Posts: 69
 
Re: Help with dynamicaly populating listboxYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Feb 08 8:27 AM
Thanks Mark that is exactly what I was looking for.
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Help with dynamicaly populating listboxYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Feb 08 11:56 AM
Moved thread to more appropriate forum (from "SalesLogix 7.2 Web Client & Application Architect" forum to "SalesLogix Scripting & VBScript" forum)
[Reply][Quote]
Mark Dykun
Posts: 297
 
Re: Help with dynamicaly populating listboxYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Feb 08 10:45 AM
Ryan,

these postings should be in web IMHO. Also

there is a problem with the code getting the IDataService from the service container. Use the following line please

Sage.Platform.Data.IDataService _dataService = ParentWorkItem.Services.Get<Sage.Platform.Data.IDataService>();

Mark
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Help with dynamicaly populating listboxYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Feb 08 10:59 AM
Did I misunderstand what Brian was asking? It wouldn't be the first time

I saw Brian's question and sample code, which is definitely code for the windows client (ADO recordsets and VBScript). I assumed he was asking about that for the LAN client. Is he asking how to do that in the web client then?

I've moved it back - sorry!
[Reply][Quote]
Mark Dykun
Posts: 297
 
Re: Help with dynamicaly populating listboxYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Feb 08 11:04 AM
No worries.

Yes he is working on the web client and was using the lan client code as a reference on how he did it there and how would/could he do it in the web client. I provided a sample in the OnChange action where he could do some databinding to the list using the IDataService as an example without having to go through the entity model to get the lookup values.

Make Sense?

Mark
[Reply][Quote]
Samantha Knigge
Posts: 2
 
Re: Help with dynamicaly populating listboxYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 May 12 11:08 AM
fiogf49gjkf0d

Mark,


I'm trying to use this in a C# code snippet inside the app arch with the combobox on a quick form, but I'm having some trouble.


First, it's not recognizing the "ParentWorkItem.Services" portion ('ParentWorkItem' does not exist in the current context).


Also, when trying to define combobox.DataSource and DataBind, there's aren't definitions for them.


Any help would be greatly appreciated, I'm very new to the web client/app arch & can't quite wrap my head around the changes from the LAN.


Thanks in advance!


Samantha

[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 © 2025 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): 6/28/2025 4:09:34 AM