Your explanation is not clear
If you are trying to get some content to display or not display on some pages based on a parameter flag set on a page, just set a
session variable (from the settings pages) and check for it on the other pages
Set it say from a form
<input type="radio" name="Flag" value="1" checked>Yes
<input type="radio" name="Flag" value="0">No
Read and set it from the form processing page
If Request.Form("Flag") = 1 Then Session("Flag") = true
Then check it in all pages using
IF Session("Flag") = true Then
' show content
Else
' don't show content
End if
--
_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________
| Hi Jim,
| The pages are asp files.
| When i open page1 i have two links; one link will open asp pages viewing
| data from sql server database, the second page will open asp page where i
| need to create some kind switch (on/off). So if you switch to 'on' then the
| link1 from first page should be enable, if switch 'off' then link1 should be
| disable. I have created table in sql database, but you saying i don't have
| to use a table.
| > For how long do you want to enable and disable access? - until i change switch on/off.
| Please let me know how should i make this work.
|
| "Jim Buyens" wrote:
|
| > Actually, the code I previously posted has an error. It should use the
| > Applciation object rather than the Session object. I have no idea what you're
| > trying to do with a database, though.
| >
| > It might help if you answered my original questions:
| >
| > What are these pages (i.e. what's the application)?
| > Why do you want to enable and disable access?
| > For how long do you want to enable and disable access?
| > What kind of action do you want to take to enable and disable access?
| >
| > Anyway, presuming you don't need to persist the switch through reboots,
| > here's the entire page that controls the switch. It doesn't need to use a
| > database. (BTW, have you thought about how to keep general Web visitors away
| > from this page?)
| >
| > <head>
| > <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
| > <title>Control Yahoo Link</title>
| > </head>
| > <body>
| > <form method="POST">
| > <%
| > If ("" & Request.Form("btnSub") <> "") Then
| > If ("" & Request.Form("chkYahoo ") = "ON") Then
| > If ("" & Application("BlockYahoo") <> "Y") Then
| > Application.Lock
| > Application("BlockYahoo") = "Y"
| > Application.UnLock
| > End If
| > Else
| > If ("" & Application("BlockYahoo") <> "N") Then
| > Application.Lock
| > Application("BlockYahoo") = "N"
| > Application.UnLock
| > End If
| > End if
| > End If
| > %>
| > <table border="0">
| > <tr>
| > <td>Yahoo Blocked:</td>
| > <td><input type="checkbox" name="chkYahoo" value="ON" <%if
| > Application("BlockYahoo") = "Y" then response.write " checked"%>></td>
| > <td><input type="submit" value="Submit" name="btnSub"></td>
| > </tr>
| > </table>
| > </form>
| > </body>
| > </html>
| >
| > And here's the code that displays the link in the page that the user sees:
| >
| > Response.Write "<a href="""
| > If ("" & Application("BlockYahoo") = "Y") Then
| > Response.Write "javascript:window.alert" & _
| > "('Link yahoo unavailable for this moment');"
| > Else
| > Response.Write "
http://www.yahoo.com"
| > End If
| > Response.Write """>Yahoo</a>"
| >
| > Jim Buyens
| > Microsoft MVP
| >
http://www.interlacken.com
| > Author of:
| > o--> Microsoft Visual Web Developer 2005 Express Edition: Build a Web Site
| > Now!
| > o--> Microsoft Office FrontPage 2003 Inside Out
| > o--> Microsoft Windows SharePoint Services Inside Out
| > o--> Faster Smarter Beginning Programming
| >
| > "GGill" wrote:
| >
| > > In asp file i added HTML Form using radio buttons and created new table - tbl
| > > Switch and field name 'switch' in SQL Database. Here is what i have, please
| > > could you point where should i enter the ASP code;
| > > ----------------------------------------------
| > > <%@ LANGUAGE="VBScript" %>
| > >
| > > <%
| > > ' ---------- init --------
| > > tablename = "tblSwitch"
| > >
| > >
| > > Set Conn = Server.CreateObject("ADODB.Connection")
| > > Conn.Open connectadminstring
| > >
| > >
| > >
| > >
| > > %>
| > > <h1>Switch On/Off</h1>
| > >
| > > <FORM METHOD="POST">
| > >
| > >
| > > <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" align="left">
| > > <TR>
| > > <TD>Switch On<% Call RadioButton("switch", "on", Request) %></TD></TR>
| > > <TR>
| > > <TD>TSwitch Off<% Call RadioButton("switch", "off", Request) %></TD></TR>
| > >
| > >
| > > <TR><TD><INPUT NAME="action" TYPE="SUBMIT" VALUE="Update"></TD></TR>
| > > </Table>
| > >
| > >
| > > </FORM>
| > > </BODY>
| > > </HTML>
| > > -----------------------------------------------
| > >
| > > "GGill" wrote:
| > >
| > > > Thank you Jim,
| > > > I am going to try and let you know how that works.
| > > >
| > > > "Jim Buyens" wrote:
| > > >
| > > > > On the page where you contol the action, I would add an HTML form with a
| > > > > checkbox named chkYahoo and a submit button named btnSub. Then, I would add
| > > > > this ASP code:
| > > > >
| > > > > If ("" & Request.Form("btnSub") <> "") Then
| > > > > If ("" & Request.Form("chkYahoo ") = "ON") Then
| > > > > Session("BlockYahoo") = "Y"
| > > > > Else
| > > > > Session("BlockYahoo") = "N"
| > > > > End if
| > > > > End If
| > > > >
| > > > > In the page Visitors would see, I would then code:
| > > > >
| > > > > Response.Write "<a href="""
| > > > > If ("" & Session("BlockYahoo") = "Y") Then
| > > > > Response.Write "javascript:window.alert" & _
| > > > > "('Link yahoo unavailable for this moment');"
| > > > > Else
| > > > > Response.Write "
http://www.yahoo.com"
| > > > > End If
| > > > > Response.Write """>Yahoo</a>"
| > > > >
| > > > > Note, however, that this still doesn't block people who might have
| > > > > bookmarked "
http://www.yahoo.com". To do that, you'd have to add some code
| > > > > like the following to the target page (which I suspect really isn't Yahoo).
| > > > >
| > > > > <body>
| > > > > <%
| > > > > If ("" & Session("BlockYahoo") = "Y") Then
| > > > > Response.Write "<p>'Link yahoo unavailable for this moment'</p>" & vbCrLf
| > > > > Response.End
| > > > > End If
| > > > >
| > > > > And of course, if you wanted this block to remain in place for a long time
| > > > > -- so long that you have to persist it across reboots -- then yes, you'd
| > > > > probably have to store the allowed/disallowed switch in a database or file
| > > > > rather than a Session variable.
| > > > >
| > > > > Jim Buyens
| > > > > Microsoft MVP
| > > > >
http://www.interlacken.com
| > > > > Author of:
| > > > > o--> Microsoft Visual Web Developer 2005 Express Edition: Build a Web Site
| > > > > Now!
| > > > > o--> Microsoft Office FrontPage 2003 Inside Out
| > > > > o--> Microsoft Windows SharePoint Services Inside Out
| > > > > o--> Faster Smarter Beginning Programming
| > > > >
| > > > >
| > > > >
| > > > > "GGill" wrote:
| > > > >
| > > > > > It's ASP pages.
| > > > > > I want to enable and disable link until i will chande switch button.
| > > > > > For example I have web page on the page I have two links, one link is yahoo
| > > > > > it will open yahoo.com site. The second link name SwitchOn/Off it will open
| > > > > > page where I should have two radio buttons, 1 radio button – ‘Switch On’, 2
| > > > > > radio button – ‘Switch Off’. So if you select ‘Switch Off’ then on the first
| > > > > > page link yahoo should not be open, if you click on link should show msgbox
| > > > > > “Link yahoo unavailable for this momentâ€, and then if you click on ‘Switch
| > > > > > On’ then you should able too open link yahoo. Do I need to create new table
| > > > > > in sql server to able to update switch button? Is a better use drop down list
| > > > > > on and off? Please help me.
| > > > > >
| > > > > >
| > > > > > "Jim Buyens" wrote:
| > > > > >
| > > > > > > There are too many ways of doing this, each with its own advantages and
| > > > > > > drawbacks, to recommend one of them based on the information you've given.
| > > > > > >
| > > > > > > What are these pages?
| > > > > > > Why do you want to enable and disable access?
| > > > > > > For how long do you want to enable and disable access?
| > > > > > > What kind of action do you want to take to enable and disable access?
| > > > > > >
| > > > > > > Jim Buyens
| > > > > > > Microsoft MVP
| > > > > > >
http://www.interlacken.com
| > > > > > > Author of:
| > > > > > > o--> Microsoft Visual Web Developer 2005 Express Edition: Build a Web Site
| > > > > > > Now!
| > > > > > > o--> Microsoft Office FrontPage 2003 Inside Out
| > > > > > > o--> Microsoft Windows SharePoint Services Inside Out
| > > > > > > o--> Faster Smarter Beginning Programming
| > > > > > >
| > > > > > > "GGill" wrote:
| > > > > > >
| > > > > > > > My web page has two links, which is Link1 will open some page and Link2
| > > > > > > > open page where I should have switch option ON/OFF, if it is OFF then when
| > > > > > > > you click on Link1 you should not able to open page, just msgbox ‘It is not
| > > > > > > > available for this moment’, and if it is ON then you will able to open link1.
| > > > > > > > Please help me to create this on/of option.
| > > > > > > >