CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

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

 Changing the Text Column of a ListBox

Print topic Send  topic

Author Message
AndyGB4

Posts: 121
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
cvboucher

Posts: 189
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.

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

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

Good idea, I'll give that a shot.

Thanks!
View profile  Send private message
vsuarez

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,

Victor
View profile  Send private message
AndyGB4

Posts: 121
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 http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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