CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.

YesSoftware Forums -> CodeCharge Studio -> ASP.NET - InMotion Framework

 Changing the Text Column of a ListBox

Print topic Send  topic

Author Message

Posts: 122
Posted: 03/15/2017, 8:09 AM Quote message

Hi, i know this forum is mostly dead, but I'll give it a try anyway because I'm stuck...

I have a ListBox, and for the sake of this example, it has ApplID as its Bound Column, and ApplNameEN as its Text Column.

How can I change the Text Column dynamically? I'd like to show ApplNameFR as the Text Column instead if a certain session equals a certain value.

I've tried changing it in the before show event, using "DataTextField" but no luck.

Any help or ideas would be greatly appreciated, thanks!

- Andrew
View profile  Send private message

Posts: 191
Posted: 03/15/2017, 10:09 AM Quote message

I don't know for sure if this will work but what if you changed the query type to SQL, add a parameter that comes from your session variable, then do a CASE statement for the text column that looks at the parameter to determine which column to return.

   CASE '{SessionParam}' WHEN 'EN' THEN ApplNameEN ELSE ApplNameFR END As ApplNameEN  
FROM ApplTable  
ORDER BY CASE '{SessionParam}' WHEN 'EN' THEN ApplNameEN ELSE ApplNameFR END  
View profile  Send private message

Posts: 122
Posted: 03/15/2017, 11:20 AM Quote message

Good idea, I'll give that a shot.

View profile  Send private message

Posts: 8
Posted: 03/15/2017, 6:21 PM Quote message

Hi Andrew,

You should also try in the AfterInitialize event using the following code:

theForm.GetControl<MTListBox>("the_listbox").DataTextField = "column_name";

Good luck,

View profile  Send private message

Posts: 122
Posted: 03/16/2017, 6:09 AM Quote message

Thanks, cvboucher, your idea worked perfectly.

I adapted it to work with more languages, and i also added some code to make sure that if the field is empty, it would default to English.

vsuarez, that's the exact line of code I used, but I put in the wrong place. I'll keep this in mind.

Thanks guys!
View profile  Send private message

Add new topic Reply to topic Subscribe to topic   

These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit

Internet Database

Visually create Web enabled database applications in minutes.

Home   |    Search   |    Members   |    Register   |    Login

Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by  and YesSoftware, Inc.