SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Hiding Area

  1. #1
    SitePoint Enthusiast
    Join Date
    May 2004
    Location
    Cambs
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hiding Area

    I have a page and dependant on what is passed via the url ie page.asp?area=xyz

    If the QueryString("area")=xzy then part of the page is hidden. How would I go about this?

  2. #2
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you only have the xzy option then use

    <%
    if request.querystring("area") = "xzy" then
    'put the code you want to be seen here

    end if
    %>
    for two options

    <%
    if request.querystring("area") = "xzy" then
    'put the code you want to be seen here
    else
    if request.querystring("area") = 123 then
    'put your code/page here
    end if
    %>
    also note if you have only one option, then the above code woudl be adequate, however if you do have multiple options then use the select case instead of if then statements

    Afrika

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2004
    Location
    Cambs
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well I tried the following code and got an error saying: Error Type:
    Microsoft JScript runtime (0x800A138F)
    Object expected

    <%if(QueryString("Area") = "xyz") {%>

    Other html and asp code

    <% } //end QueryString("Area") = "xyz" %>

    Any Ideas?

  4. #4
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    where did you get the code i highlighted in red below
    copy and paste my code above, just as it is

    Edit the code to read whatever you want. Ie to insert the page you want to insert

    or better yet.
    Insert your code which you want seen in this forum, and i will get it done fro you.
    Afrika

    Code:
    <%if(QueryString("Area") = "xyz") {%>
    
    Other html and asp code
    
    <% 
    Code:
    } //end
    QueryString("Area") = "xyz" %>

  5. #5
    SitePoint Enthusiast
    Join Date
    May 2004
    Location
    Cambs
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have used the same principle as I use to hide a recordset if it is empty. The way you suggested means that everything has to go within the asp whereas my method should just sandwich any content on the page.

  6. #6
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i dont understand your last statement. In the first post you said hide some aread, now you say recordset. which is which ?

    however what i could recommend is still the same as above. Try this


    <%
    if request.querystring("area") = "xzy" then
    %>

    Your HTML PAGE GOES HERE

    <&end if
    &>
    If you are looking to check if a recordset is empty or not, then use an SQL query

    if its MS SQL server then use

    if exists statement

    ... then run some code based on if exists or not

    Alternatively in ASP page you could use the if not recordset1.eof and not recordset1.bof then

    ...run some code


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •