Page 3 of 3 First 123
  • Jump to page:
    #31
  1. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    May 2006
    Posts
    51
    Rep Power
    17
    Nice advice...

    Comments on this post

    • Shadow Wizard disagrees : silly comment made only to boost post count. you could click the scales and say this - and this kind of posts is typical for you I fear.
    • freeasphelp disagrees
    • D.O.M.I.N.A.T.O.R disagrees
  2. #32
  3. Beyond The Impossible
    ASP Adventurer (500 - 999 posts)

    Join Date
    Sep 2003
    Location
    Shawnee Mission, KS, USA
    Posts
    921
    Rep Power
    16
    Parent Paths can be enabled on just one site or all sites its your choice.
    John Shepard
    Beyond The Impossible
    -----------------------------
    Has a post helped you? Please show your apprecitation by clicking the
    image in the right upper corner.
    Posting code? Put your code between [code] and [/code] tags.
    X-Login and X-Send
  4. #33
  5. Contributing User
    ASP Adventurer (500 - 999 posts)

    Join Date
    Nov 2004
    Location
    Montreal
    Posts
    668
    Rep Power
    34
    hey guys , great advise all arround.

    although i did find it a bit annoying to go threw each post 1 by 1 so i figured i make a pdf of this thread.

    I will always try to keep the pdf updated if there is new posts.

    M.

    Comments on this post

    • Shadow Wizard agrees : that's really great Mark, thanks!
    • PhilCollins99 agrees : Extra effort is always worth recognition!! You're the first person to receive 11 reputation points from me. ;D
    Attached Files
    Mark
    If you found a post particularly helpful, show your appreciation by clicking the "scales" icon in the bar just above the post, at the right hand side.
  6. #34
  7. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jun 2007
    Posts
    27
    Rep Power
    0
    Where is WEB EXTENSIONS??? i cant seem to find anything saying "web extensions"..
  8. #35
  9. Moderator From Beyond
    ASP Mastermind (5000+ posts)

    Join Date
    Sep 2004
    Location
    Israel
    Posts
    31,135
    Rep Power
    2925
    Originally Posted by asfia
    Where is WEB EXTENSIONS??? i cant seem to find anything saying "web extensions"..
    what post you mean?
  10. #36
  11. No Profile Picture
    Contributing User
    ASP Discoverer (100 - 499 posts)

    Join Date
    Jul 2007
    Posts
    135
    Rep Power
    22

    Tips & Tricks


    Not sure if it's been done here before, since I'm new, but it's always nice to see people's trick and tips for coding in asp.

    Here's a few from moi:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Checking if a string is empty:

    -> If strMyString = "" Then 'This is slow
    -> If Len(strMyString) = 0 Then 'This is faster
    -> If LenB(strMyString) = 0 Then 'This is the fastest


    Naming variables:

    -> Use meaningfull name, a name that will describe the variable.
    -> Use a prefix. I usually use the three letters. str = String, int = Integer, obj = Object, cur = Currency, etc...


    Querying Database:

    -> Open your database as soon as possible and close as soon as possible
    -> I usually do my database query at the top and put everything in a two dimentional array (using arrMyRecords = rs.getRows) so my connection can be closed right away


    Pre-select Dropdown options:

    -> Put the whole list of option (<option value=""abc"">abc</option>) in a string
    -> To preselect, do Replace(strMyList, "<option value=""" & strMyValue & """", "<option value=""" & strMyValue & """ selected") , that way you do no need to do 'if then' in every loop.


    Menu/items in an array:

    -> If you need to put a menu in an array, using position is not very user friendly when you need to update it. If you need to re-organized or remove one, you will have to update all the position, instead, do an array of arrays:

    arrMenu = Array(_
    Array("Menu 1", "url1"), _
    Array("Menu 2", "url2"), _
    Array("Menu 3", "url3"), _
    Array("Menu 4", "url4") _
    )

    Then you can loop by doing:

    For Each menuItem In arrMenu
    strMenuName = menuItem(0)
    Next


    I'll think about more...
  12. #37
  13. Senior Sarcasm Wizardess
    ASP Mastermind (5000+ posts)

    Join Date
    Feb 2005
    Location
    Dreamland
    Posts
    13,608
    Rep Power
    2465
    Thanks for posting ... I have merged this into an existing thread we have. Please post other tips here.
    Quote of the Month:
    Planning: Much work remains to be done before we can announce our total failure to make any progress.

    Questions to Ponder:
    If convenience stores are open 24 hours a day, 365 days a year, why are there locks on the doors?

    iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm")
    copyrightę 2008 sbenj69
  14. #38
  15. No Profile Picture
    Contributing User
    ASP Discoverer (100 - 499 posts)

    Join Date
    Jul 2007
    Posts
    135
    Rep Power
    22
    Originally Posted by mehere
    Thanks for posting ... I have merged this into an existing thread we have. Please post other tips here.
    Thanks, I was wondering where it went...

    Here's a few more that I use frequently:


    Post data form to form

    Code:
    For intX=1 To Request.Form.Count
    	Response.Write "<input type=""hidden"" name=""" & Request.Form.Key(intX) & """ value=""" & Server.HTMLEncode(Request.Form.Item(intX)) & """>"
    Next
    Paging Recordset + Array

    Code:
    'cITEMS_PER_PAGE is the number of rows per page
    'intStartAtRow is where to start extracting
    'intCurrentPage is the cursor you move from page to page, default is 1
    
    'do you usual database stuff here
    
    intStartAtRow = cITEMS_PER_PAGE * (intCurrentPage - 1)
    
    If Not rs.EOF Then
    	rs.Move = intStartAtRow
    	
    	If Not rs.EOF Then arrResults = rs.getRows(cITEMS_PER_PAGE, adBookmarkCurrent)
    End If
    
    'close db connection
    'arrResults is now a two dimensional array that hold your records
    Inserting related record in db
    For example, you have a product and you want to select all the categories that it goes in:

    Code:
    'Put all categories in a dropdown (with multiple select) or in checkbox, put the id in the value and name it category_ids
    'Then for saving:
    
    intProductID = Request.Form("product_id")
    
    'open db
    
    'this line is when you're editing
    Set rs = conn.Execute("DELETE FROM products_categories WHERE product_id=" & intProductID)			
    
    'adding related categories only if there is some selected
    If LenB(Request.Form("category_ids")) > 0 Then 
    	Set rs = conn.Execute("INSERT INTO products_categories (product_id, category_id) SELECT " & intProductID& ", id FROM categories WHERE id IN (" & Request.Form("category_ids") & ")")
    End If
    
    'close db
Page 3 of 3 First 123
  • Jump to page:

Similar Threads

  1. Different way of doing things
    By sam_sam in forum ASP Development
    Replies: 1
    Last Post: April 7th, 2005, 06:15 PM
  2. Need help on some things.
    By Borgis1 in forum Code Bank
    Replies: 46
    Last Post: February 17th, 2005, 02:16 AM
  3. Replies: 3
    Last Post: December 28th, 2003, 11:48 PM
  4. Need HELP! Trying to limit data in a chart among other things
    By electrobirdy in forum Microsoft Access Help
    Replies: 1
    Last Post: November 16th, 2003, 10:11 PM
  5. weird things with Redirect
    By Steve Schofield in forum ASP Development
    Replies: 2
    Last Post: November 9th, 2000, 03:56 AM

IMN logo majestic logo threadwatch logo seochat tools logo