CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
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: 122
Posted: 03/15/2017, 8:09 AM

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: 191
Posted: 03/15/2017, 10:09 AM

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: 122
Posted: 03/15/2017, 11:20 AM

Good idea, I'll give that a shot.

Thanks!
View profile  Send private message
vsuarez

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

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: 122
Posted: 03/16/2017, 6:09 AM

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 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.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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