navcan
Posts: 61
|
| Posted: 07/23/2004, 5:27 AM |
|
Hi all,
I have an asp page with two static tables, page has no databound grids/tables/forms. It's a complete static page with Restricted = YES. Both User and Administrator can access the page.
I am hide both table using Template Block
<!-- BEGIN SysAdmTbl -->
<div id="elButton">
<table>
<tr>
<td>
<p>System Administration</p>
</td>
</tr>
</div>
</table>
<!-- END SysAdmTbl -->
<!-- BEGIN UserTbl -->
<div id="elButton">
<table>
<tr>
<td>
<p>System Administration</p>
</td>
</tr>
</div>
</table>
<!-- END UserTbl -->
In page before show, I have the code as follow:
Function Page_BeforeShow() 'Page_BeforeShow @1-653D685B
'Custom Code @37-73254650
' -------------------------
' Hide Template Block SysAdmTbl if not login as Admin
if Session("GroupID") <> 2 then
HTMLTemplate.Parse "SysAdmTbl", False
end if
'Hide Template Block UserTbl if not login as User
if Session("GroupID") <> 1 then
HTMLTemplate.Parse "UserTbl", False
end if
Question 1. Is the above before show code correct to hide the template block? Using the above code is not working for me and hiding both template blocks no matter who is logged in user or admin.
Question 1. What is the correct code to hide a template block if the page is not bound to any databound form/grid/record? and where to put this code i.e. before show, after initialize or on initialize view???
' -------------------------
'End Custom Code
End Function 'Close Page_BeforeShow @1-54C34B28
I tried using EventCaller, got the error
Microsoft VBScript runtime error '800a01a8'
Object required: 'EventCaller'
Tried using
if CCGetGroupID() < 2 then
EventCaller.HTMLTemplate.SetVar "@SysAdm",""
end if
NO Luck!
Please help...
|
 |
 |
DonB
|
| Posted: 07/23/2004, 1:41 PM |
|
Forget about manipulating the template directly. Put in a BeforeShow event
for the page and put this line for each control :
Eventcaller.SysAdmTbl.Visible = CCGetGroupID() <> 2
Eventcaller.UserTbl.Visible = CCGetGroupID() <>1
Now, what is supposed to happen with the GroupID is neither 1 nor 2?
--
DonB
logging at http://www.gotodon.com/ccbth, and blogging at http://ccbth.gotodon.net
"navcan" <navcan@forum.codecharge> wrote in message
news:64101044ba9477@news.codecharge.com...
> Hi all,
>
> I have an asp page with two static tables, page has no databound
> grids/tables/forms. It's a complete static page with Restricted = YES.
Both
> User and Administrator can access the page.
>
> I am hide both table using Template Block
>
> <!-- BEGIN SysAdmTbl -->
> <div id="elButton">
> <table>
> <tr>
> <td>
> <p>System Administration</p>
> </td>
> </tr>
> </div>
> </table>
> <!-- END SysAdmTbl -->
>
> <!-- BEGIN UserTbl -->
> <div id="elButton">
> <table>
> <tr>
> <td>
> <p>System Administration</p>
> </td>
> </tr>
> </div>
> </table>
> <!-- END UserTbl -->
>
> In page before show, I have the code as follow:
>
> Function Page_BeforeShow() 'Page_BeforeShow @1-653D685B
>
> 'Custom Code @37-73254650
> ' -------------------------
> ' Hide Template Block SysAdmTbl if not login as Admin
> if Session("GroupID") <> 2 then
> HTMLTemplate.Parse "SysAdmTbl", False
> end if
>
> 'Hide Template Block UserTbl if not login as User
> if Session("GroupID") <> 1 then
> HTMLTemplate.Parse "UserTbl", False
> end if
>
> Question 1. Is the above before show code correct to hide the template
block?
> Using the above code is not working for me and hiding both template blocks
no
> matter who is logged in user or admin.
>
> Question 1. What is the correct code to hide a template block if the page
is
> not bound to any databound form/grid/record? and where to put this code
i.e.
> before show, after initialize or on initialize view???
>
> ' -------------------------
> 'End Custom Code
> End Function 'Close Page_BeforeShow @1-54C34B28
>
> I tried using EventCaller, got the error
>
> Microsoft VBScript runtime error '800a01a8'
> Object required: 'EventCaller'
>
> Tried using
> if CCGetGroupID() < 2 then
> EventCaller.HTMLTemplate.SetVar "@SysAdm",""
> end if
>
> NO Luck!
>
> Please help...
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
|