Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, July 1, 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: manually loading a combo box in web
Glenn Williams
Posts: 51
 
manually loading a combo box in webYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Feb 10 3:35 PM
i'm trying to load a combo box or list box with the followoing code:

PanelRefresh.RefreshTabWorkspace();

QFListBox.Items.Add("ABC", "456");
Gives the error (sumarized) smart part failed to load; error;no overload for method 'Add" takes '2' arguments.

QFListBox.Items.Add("ABC");
This yields no erros, but doesn't seem to do anything.


PanelRefresh.RefreshTabWorkspace();
I added this to the end, but no change

Ultimately, I have a set of data (text and values) that I need to load into a combo. I am getting the values back from a dll I wrote.

[Reply][Quote]
Mike LaSpina
Posts: 116
 
Re: manually loading a combo box in webYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Feb 10 4:02 PM
You need to add a list item:

ListItem i = new ListItem("ABC", "456");
QFListBox.Items.Add(i);


ListItem is located in System.Web.UI.WeControls
[Reply][Quote]
Glenn Williams
Posts: 51
 
Re: manually loading a combo box in webYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Feb 10 4:19 PM
Looks good , but I can't get it to work.

mabe it cause I don't know if I need to do anything with this:
>>ListItem is located in System.Web.UI.WeControls

I'm trying he code from a button using a OnClick C# snippet. Are the above 2 lines all I need?
[Reply][Quote]
Mike LaSpina
Posts: 116
 
Re: manually loading a combo box in webYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Feb 10 4:23 PM
It should be. If you don't have a 'using' in your code, you'll need to spell out the assembly name for ListItem:


System.Web.UI.WeControls.ListItem i = new System.Web.UI.WeControls.ListItem("ABC", "456");
QFListBox.Items.Add(i);


[Reply][Quote]
Glenn Williams
Posts: 51
 
Re: manually loading a combo box in webYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Feb 10 4:26 PM
I had some values stored in the Items.collection property area. When I cleared that out the codes started working.

Still, I feel like you're trying to tell me something with this bit of information, but I don't know what.
>>ListItem is located in System.Web.UI.WeControls

thanks very much for your help.
[Reply][Quote]
Mike LaSpina
Posts: 116
 
Re: manually loading a combo box in webYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Feb 10 5:31 PM
I was just letting you know where the List class is located. However, I had a typo in there and missed a 'b'. It should read "System.Web.UI.WebControls"
[Reply][Quote]
Glenn Williams
Posts: 51
 
Re: manually loading a combo box in webYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Feb 10 2:29 PM
This works great:
ListItem i = new ListItem("ABC", "456");
QFListBox.Items.Add(i);

The dropdown displays "ABC" and the form saves "456", but when I re-open the form 456 is displayed. Do I have to manually code around this to fix it or is there a better solution?

I guess I have to build the combo box on form open and make sure it displays the proper text & value??
[Reply][Quote]
Mike LaSpina
Posts: 116
 
Re: manually loading a combo box in webYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Feb 10 2:37 PM
Hmm - sounds like some sort of issue there. I've always loaded them up when the form opens up, so having existing items when the form is opened has not been an issue for me in the past.
[Reply][Quote]
David Lumm
Posts: 87
 
Re: manually loading a combo box in webYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Feb 10 11:38 AM
Since the value is saved in the Database and not the text, the item needs to exist in the list before it binds or else it will just display the value.

What I tend to do in this situation is stick the following after I've generated/modified the list
try {
QFListBox.DataBind;
}
catch
{
}

Also, the way you create the list item isn't the only way. I tend to do the following, only because it's slightly quicker to write...
QFListBox.Items.Add(new ListItem("ABC", "456"));
[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): 7/1/2025 8:00:00 AM