Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - show hide table records
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

show hide table records

 Post Reply Post Reply
Author
urko View Drop Down
Groupie
Groupie
Avatar

Joined: 23 September 2004
Location: Slovenia
Status: Offline
Points: 160
Post Options Post Options   Thanks (0) Thanks(0)   Quote urko Quote  Post ReplyReply Direct Link To This Post Topic: show hide table records
    Posted: 25 August 2005 at 7:59am
Hey guys

I have some problem that I can't solve!
I'm using Candypress store and I have made additional table in db to be shown when users click to category 4.

Now I have added this in prodview.asp page where I inserted the tables, but no luck:
Quote
<%
If category = 4 then
'show table1
end if
%>

Is this the right thing or needs more coding??Confused
Urko
Back to Top
wingking View Drop Down
Groupie
Groupie
Avatar

Joined: 09 January 2004
Location: United States
Status: Offline
Points: 99
Post Options Post Options   Thanks (0) Thanks(0)   Quote wingking Quote  Post ReplyReply Direct Link To This Post Posted: 25 August 2005 at 12:47pm
well for one thing you commented out the show table 1
Back to Top
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Posted: 25 August 2005 at 8:52pm
The commented line I think is just to say that's where the code to show table is placed.

Without knowing more about the mechanics of this application, is difficult to say what's wrong.

Can you post more code, or tell us how it works?
Back to Top
urko View Drop Down
Groupie
Groupie
Avatar

Joined: 23 September 2004
Location: Slovenia
Status: Offline
Points: 160
Post Options Post Options   Thanks (0) Thanks(0)   Quote urko Quote  Post ReplyReply Direct Link To This Post Posted: 26 August 2005 at 3:05am
Quote <table width="100%" border="0" cellpadding="0" height="20" cellspacing="0">
      <tr><td width="80%"><b>View Loads:</b></td><td width="20%"><div align="right"><b><a href="add_load.asp?id=<%=(cartridges.Fie lds.Item("id").Value)%>">ADD Your LOAD:</a></b></div></td>
     
    </tr>
    </table>
    <table width="100%" border="0" cellpadding="0" height="20" cellspacing="0" style="border:1px solid #000000;" bgcolor="#f4f4f4">
         <!--DWLayoutTable-->
              <tr>
                <td width="15%" valign="middle" style="padding-left:5px;"><strong>Load ID #</strong></td>
                      
                     <td width="30%" valign="middle" style="padding-left:5px;"><strong>Bullet weight / type</strong></td>
                     <td width="30%" valign="middle" style="padding-left:5px;"><strong>Powder</strong></t d>
                     <td width="25%" valign="middle" style="padding-left:5px;"><strong>Unit</strong></td& amp; amp; gt;
              </tr>
            </table>
    <div align="center">
           <% If  loads.EOF Or  loads.BOF Then
  Response.Write("<br>No loads yet!<br><br>Be the first to add load for <b>" & cartridges("Title")&"</b> caliber!")
Else
  %>
           <%
While ((Repeat1__numRows <> 0) AND (NOT loads.EOF))
%>
            <table width="100%" border="0" cellpadding="0" height="20" cellspacing="0" style="border-bottom:1px solid #000000;border-right:1px solid #000000;border-left:1px solid #000000;" bgcolor="">
                <!--DWLayoutTable-->
                <tr>
                &a mp;a mp;n bsp; <td width="15%" valign="middle" style="padding-left:5px;"><div align="left"><a href="#" onClick="MyWindow=window.open('http://myserver/loads_display.asp?load_id=& amp; lt;%=(loads.Fields.Item("Load_id").Value)%>','MyWindow','toolbar=no,location=no,directories =no,st atus=no,menubar=no,scrollbars=no,resizable=no,width=500,height=620'); return false;">&a mp;l t;%=(loa ds.Fields.Item("Load_id").Value)%></a></div></td>
                    
                  <td width="30%" valign="middle" style="padding-left:5px;"><div align="left"><%=(loads.Fields.Item("bul let_weight").Value)%>&nbsp;<%=(loads.Fields.Item("bullet").Value)%></div></t d& gt;
                   <td width="30%" valign="middle" style="padding-left:5px;"><div align="left"><%=(loads.Fields.Item("pow der").Value)%></div></td>
                &a mp;a mp;n bsp;    <td width="25%" valign="middle" style="padding-left:5px;"><div align="left"><%=(loads.Fields.Item("unit_mettric_english ").Value)%> </div></td>
                </tr>
              </table>
            <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  loads.MoveNext()
Wend
%>
            <br>
            <%
For i = 1 to loads_total Step MM_size
TM_endCount = i + MM_size - 1
if TM_endCount > loads_total Then TM_endCount = loads_total
if i <> MM_offset + 1 Then
Response.Write("<a href=""" & Request.ServerVariables("URL") & "?" & MM_keepMove & "offset=" & i-1 & """>")
Response.Write(i & "-" & TM_endCount & "</a>")
else
Response.Write("<b>" & i & "-" & TM_endCount & "</b>")
End if
if(TM_endCount <> loads_total) then Response.Write(" ")
next
 %>
            <% end if ' load%>


Ok, now the thing is that I would like to use this page for displaying records from catID 1,2,3,4 and 5, but would like to hide above code if catid is 1,2,3 and 5 is displayed!
The reason is that if you choose catid 4 you could add some informations ( add ballistic loads etc..) but if you choose catID 1,2,3,5 you can add comments to certain product.



Edited by urko - 26 August 2005 at 5:01am
Urko
Back to Top
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Posted: 26 August 2005 at 7:36am
Originally posted by urko urko wrote:

Ok, now the thing is that I would like to use this page for displaying records from catID 1,2,3,4 and 5, but would like to hide above code if catid is 1,2,3 and 5 is displayed!...

I still don't get the point, your declaration above seam to be in conflict, first you say you want to use the code above to show catID 1,2,3,4,5 then you say you don't want to use the code above to show catID 1,2,3,...,5, just 4. Could it be that you just want to use it to display cat 4?

Another thing with the code is that it's very messy, you could filter cat 4 only on your SQL stat, or on the [While/Wend] loop do this:

While Repeat1__numRows <> 0 And NOT loads.EOF And loads.Fields.Item("catID").Value = 4

...
Wend
Not my prefered method

Why do you have to reference fields like this: [loads.Fields.Item("catID").Value] can't you just [loads.("catID")] or something?

The prefered method to do what you want would be to add optional fields to your cats table, such as [fldShow] a boolean type setting whether to show this cat or not, and [fldType] a string type defining what this category holds, ex. [ballistic loads, comments, etc], also, you shouldn't be referencing cats by ID, IDs should be dynamic, and may change, even if you hook on the the index ID, which don't change until the records is deleted, next time the category is created a new ID will be assigned to it and your code will not work then.
Back to Top
urko View Drop Down
Groupie
Groupie
Avatar

Joined: 23 September 2004
Location: Slovenia
Status: Offline
Points: 160
Post Options Post Options   Thanks (0) Thanks(0)   Quote urko Quote  Post ReplyReply Direct Link To This Post Posted: 26 August 2005 at 7:59am
Sorry, my mistake.

What I want is that if you click products which are under catID=4,you will see tables and code inside tables.

If you click products which are under catID=1,2,3 or 5 then the tables and and code inside tables would be hidden!
(Hope u know what I mean by thatWink).

The fileds [loads.Fields.Item("catID").Value] were made by Dreamweaver as I i'm still learning asp code, but I have already started to write some code and these codes are written [loads.("catID")]. ( still a newbie  in asp Smile).

Second thing that I would like to learn is, how do you work with check boxes!
Example:
I have made additional cell in DB called Active. If it's uncheked then the record will not be displayed, if checked then it will displayed. The reason I want that is, I want to see the record if it's ok, or does it needs to be repaired before I publish it as it may be miss-information to others!

Can you explain a little what code must be written so that if the checkbox is not checked then record will not be shown?

I have created admin pages but I don't know what code to write so that the checkbox will work properly.

Really appreciate your help,

Thanks,

Urko
Back to Top
wingking View Drop Down
Groupie
Groupie
Avatar

Joined: 09 January 2004
Location: United States
Status: Offline
Points: 99
Post Options Post Options   Thanks (0) Thanks(0)   Quote wingking Quote  Post ReplyReply Direct Link To This Post Posted: 26 August 2005 at 11:15am
my brain hurts...
but couldn't you just acomplish this with an if statement
if catid = 4 then
response.write blah blah blah
end if
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.