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

 Link control hide/show

Print topic Send  topic

Author Message
JerryVT
Posted: 03/01/2004, 11:53 PM

Hi,
I'm still struggling with link conrol.
I want to have Header with links to different pages and I want to hide some links depending on UserLevel.

Do I have to place link control within grid or this is not required?

If I just place it on the page and try refrencing it in code I get an error that vaiable is not defined.
How do I reference it?
peterr


Posts: 5971
Posted: 03/02/2004, 12:55 AM

Hi,
There is one thread about this topic at: http://forums.codecharge.com/posts.php?post_id=27353

_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
DonB
Posted: 03/02/2004, 6:49 AM

Here's the way I hide an "admin" link in a header:

Function StandardHeader_LinkAdmin_BeforeShow()
'StandardHeader_LinkAdmin_BeforeShow @16-22997C0A

'Custom Code @17-73254650
' -------------------------
Eventcaller.Visible = CCGetGroupID() =99
' -------------------------
'End Custom Code

If the groupID is not 99 then the link is hidden. "Eventcaller" is a
reference the Link control (CCS generates this object reference for you).

--
DonB

http://www.gotodon.com/ccbth


"JerryVT" <JerryVT@forum.codecharge> wrote in message
news:640443d8475efa@news.codecharge.com...
> Hi,
> I'm still struggling with link conrol.
> I want to have Header with links to different pages and I want to hide
some links depending on UserLevel.
>
> Do I have to place link control within grid or this is not required?
>
> If I just place it on the page and try refrencing it in code I get an
error that vaiable is not defined.
> How do I reference it?
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Joe
Posted: 11/03/2004, 10:37 AM

I want to do the samething, but i want to display the link only if a field in there users table is YES

I tried this but no luck
Eventcaller.Visible = CCdlookUp("Rates", "Users", Users.DataSource.Where & " AND Rates='Yes' " , DBConnection1)

Table Name: Users
Field Name: Rates
Field Values: Yes or No
.asp
SQL
CCS
peterr


Posts: 5971
Posted: 11/03/2004, 10:41 AM

It would help to know what means "no luck" - please always describe the symptoms of the problem, otherwise it's difficult to figure out what help you may need. Is EventCaller.Visible not working? or CCDLookup is not working? what are the error messages? etc.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Joe
Posted: 11/03/2004, 11:39 AM

Sorry Peterr
EventCaller.Visible is working

it is the CCDLookup that is not. I am getting a HTTP 500 error. The page loads ok. The link is inside of a grid. the by default is Invisible. until a value is select from the drop down box. When i select a value and the page refreshes to show me the results. that is when it goes blank. with the error.
Eventcaller.Visible = CCdlookUp("Rates", "Users", Users.DataSource.Where & " AND Rates='Yes' " , DBConnection1)
peterr


Posts: 5971
Posted: 11/03/2004, 11:54 AM

First please resolve your HTTP 500 error: http://www.webwizguide.info/asp/faq/friendly_HTTP_error_messages.asp
Once this is taken care of you should see the exact error message that should provide more details about the problem.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Joe
Posted: 11/03/2004, 12:00 PM

Peterr,
I get the following error

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'Visible'

/FreightCenter/Classes.asp, line 793
peterr


Posts: 5971
Posted: 11/03/2004, 12:33 PM

Thanks, it's clear now that Visible can only be boolean True or False and cannot be text "Yes" or "No". You may need to add an If statement and use only Eventcaller.Visible = True or Eventcaller.Visible = False, depending on what the Dlookup function returns.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Joe
Posted: 11/03/2004, 12:58 PM

Peterr, Thanks i understand a little more, but i have no clue, any help would be great. i went to the link prop and set it to Boolean and then set the format to True;False I also edited my code to read this. still get the

Eventcaller.Visible = CCdlookUp("Rates", "Users", Users.DataSource.Where & " AND Rates='True' " , DBConnection1)

Still did not work, so then i tried this code
If Eventcaller.Visible = CCdlookUp("Rates", "Users", Users.DataSource.Where & " AND Rates='True' " , DBConnection1)  Then  
     Eventcaller.Visible = True   
	 End If
And it goes through with no error. it just does not show the link. what am i doing wrong. an dthanks for all your help peterr
Joe
Posted: 11/03/2004, 1:51 PM

Peterr
I also tried this but no luck either:
If Eventcaller.Visible = CCdlookUp("Rates", "Users", Users.DataSource.Where & " AND Rates=False" , DBConnection1)  Then    
     Eventcaller.Visible = False  
	 End If
Any help would be great, Thanks
peterr


Posts: 5971
Posted: 11/03/2004, 2:30 PM

It should be something like this:
If CCdlookUp("Rates", "Users", Users.DataSource.Where & " AND Rates=False" , DBConnection1) = "Yes" Then Eventcaller.Visible = True Else Eventcaller.Visible =False 

_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Joe
Posted: 11/04/2004, 7:01 AM

Hey peterr,
I now get the following error
Quote :
Source: CCDLookUp function
Command Text: SELECT Rates FROM Users WHERE [UsrID] = 44 AND Rates=False
Error description: Invalid column name 'False'. (Microsoft OLE DB Provider for SQL Server)<br>
So I tried this with single quotes around the value 'false' and I get no error and no Link, but I am a little confused, The value in the field Rates is a Yes or No Value. Should I set that to True or False, and should I change the data type to Boolean or keep it as text, I have tried all but nothing yet. I appreciate all your help. I feel I am right there but maybe I am forgetting something.
mrachow


Posts: 509
Posted: 11/04/2004, 9:51 AM

So use 0 (zero).
This should "fulfil" false on most databases.

Regards,
Michael
_________________
Best regards,
Michael
View profile  Send private message
peterr


Posts: 5971
Posted: 11/04/2004, 1:48 PM

Joe,

Looks like You mixed up 2 seperate topics: I wrote that "Visible can only be boolean True or False", but now you are talking about a different problem - with CCDLookup.

I never talked about changing your SQL statement like Rates=False.
I only wrote that the Visible prioperty can only be boolean True or False and I gave you an example: Eventcaller.Visible = True Else Eventcaller.Visible =False.

This is unrelated to your database, SQL statements or CCDLookUp. Only you know how your database is structured and therefore what SQL statement to use. It's not important if your database values contain boolean values or text. You may need to test your CCDLookup function first and make it work correctly. Once it is working then use my logic above to control the Visible property.

If you need technical support please contact http://support.yessoftware.com.

Thanks
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
smalloy

Posts: 107
Posted: 11/05/2004, 1:15 PM

I have the same problem but using either:

Eventcaller.Visible = CCGetGroupID() =2

or

'Lookup user's security level
Dim security_level
Dim myconnection

'Instantiate Connection
SET myconnection = New clsDBinternet
myconnection.open
security_level = CCDLookup("group_id", "users", "user_id=" & CCGetUserID(), myconnection)

'Hide appropriate Links
Select Case security_level
Case 1
lnkWebAdmin.Value = ""
lnkClaims.Value = ""
Case 2

End Select
' -------------------------
'End Custom Code

End Function 'Close FormMenu_1_BeforeShow @1-54C34B28


Both of these work but only to the extent that the link itself, that is the URL, is gone, not the Link Control . I need the control to be either Visible = False or not loaded. I don't want customers to know that they do not have some rights that other customers have.

Any advice??? Can it be done?
Thanks


_________________
Anything can be done, just give me time and money.
View profile  Send private message
peterr


Posts: 5971
Posted: 11/05/2004, 1:20 PM

Please try this for the 1st case: right click on the Link, select "Edit Link", then check the "Extended HTML" option.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
smalloy

Posts: 107
Posted: 11/05/2004, 1:49 PM

OK, I did and it is no longer visible, but - I can't get it to be visible even with
Eventcaller.Visible = True

Thanks for helping!
_________________
Anything can be done, just give me time and money.
View profile  Send private message
peterr


Posts: 5971
Posted: 11/05/2004, 2:30 PM

Possibly your link has no value. For example the HTML of the link in the design mode may need to look like: <a href="{Link1_Src}">MyLink</a>
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
smalloy

Posts: 107
Posted: 11/05/2004, 2:45 PM

That was the issue!

THANKS!
_________________
Anything can be done, just give me time and money.
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.

Web Database

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.