CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> ASP

 Hiding column based on session

Print topic Send  topic

Author Message
Rene S
Posted: 01/14/2006, 7:22 AM

Hi,

I am trying to build a multiple language site. I figured out that it is not so hard to do it if every record is a seperate language. However I don't want to do that for a products/descriptions database, because I would have to enter each product 4 times.

So my question is:

Is it possible to show/hide a column of a grid based on the (language) session? I want to use 4 languages. And if so, could someone maybe give a code example in ASP?

Thanks,

Rene
peterr


Posts: 5971
Posted: 01/14/2006, 2:05 PM

Hi Rene,

Depending on implementation there may be not too much difference between the amount of data entered into 4 records vs one record with 4 fields. I would recommend creating "product_translations" table, then on the product maintenance admin page you can place a link "Edit translations" next to each product, which would display an editable grid with the 4 translations.

Anyway, regarding hiding column grids, there is an example titled "Using panels to hide grid columns" in CCS Example Pack 2. Another one is in the "Working with Panels" section of the documentation. That one shows how to hide panels based on the user id session, so you'd need to replace UserID with the language/locale session variable. By default that session variable name is "locale", but it can be named differently or turned on/off in Project Settings -> Locales & Encodings -> Advanced.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Rene S
Posted: 01/14/2006, 3:27 PM

Hi,

First, thanks Peter R. for quick response.

The problem I'm having is that the products have a description. They have a language independent "name" and then about 20 "details" (stored in different tables and joined by ID.) wich are language dependent (color etc.) However these descriptions are stored in tables only ones, so nothing much to maintain. The products (5000 of them) can change a lot over time, so that is a lot of data to enter if I need to do that for every product/language.


I have made a table "color" with in it "Color_ID" "Color_NL" "Color_EN" Color_IT" "Color_DE"
How do I show only the column with the right Color based upon the session "lang"?
What is the "syntax" etc to put together a show/hide of a panel based on a session? I'm not a programmer so please expand your thoughts as much as possible.

Thanks alot!

Rene
peterr


Posts: 5971
Posted: 01/14/2006, 3:41 PM

Rene,

In your case the code could be:
'Hide non-English panels  
If Session("locale") = "en" Then  
     Panel_NL.Visible = false  
     Panel_IT.Visible = false  
     Panel_DE.Visible = false  
End if  
  
'Hide non-Dutch panels  
If Session("locale") = "nl" Then  
     Panel_EN.Visible = false  
     Panel_IT.Visible = false  
     Panel_DE.Visible = false  
End if  
'etc.  

You may just need to name your panels accordingly, like "Panel_NL" for Dutch column.
The example I mentioned above also explains how to create grids with panels that can be hidden, and you will find similar code in both examples I mentioned.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
TheunisP

Posts: 342
Posted: 01/15/2006, 1:40 AM

Rene , a better solution would be to make all invisible thru theri properties as a default then you run this code:

select Session("locale")
case "en"
Panel_EN.Visible = TRUE

case "nl"
Panel_NL.Visible = TRUE

case else
' default language here

end select


this is way less code and easier to maintain
View profile  Send private message
Rene S
Posted: 01/16/2006, 2:11 PM

Thanks a million!!!!!

It works like a charm.

A Very happy Rene

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.

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.