Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6

Thread: ASP.NET and CSS

  1. #1
    Senior Member Holokai's Avatar
    Join Date
    Sep 2004
    Location
    Honolulu, HI
    Posts
    127
    Member #
    7707
    Hey all, another question for you.

    I just switched over from PHP to ASP.NET. one huge and obvious difference is that with PHP you can use the <? and ?> tags to start writing HTML or PHP wherever you wanted to. Thus, creating a while loop that pulls things out of a database and formats the information at the same time was fairly quick and easy.

    With ASP, however, the code is an entirely seperate file from the HTML it generates. So here's the question. Two of them, really. What is the best way to "display" generated HTML? Using Labels?

    And, more importantly, if Labels are the answer, is there a better way to generate the HTML than this?
    Code:
    while(reader.Read())
    			{
    				main.Text += "<div class=\"article\"><div class=\"title\">"+reader["title"]+"</div>";
    			}
    This is just going to generate a jumble of nasty looking HTML when it's all said and done.

    Any ideas? Thansk!

    - Chris
    -----------------------------------------------
    I know just enough to be dangerous to myself and others around me... I'm more of a CSS kamikaze than a CSS ninja...

  2.  

  3. #2
    Senior Member echoSwe's Avatar
    Join Date
    May 2004
    Posts
    332
    Member #
    5926
    You never use labels to format data from databases like that.

    use DataList/DataGrid or Repeater controls.

    Read a tutorial. Your questions are pretty basic. www.asp.net to start.

    Otherwhise I recommend http://www.amazon.com/gp/product/095...lance&n=283155

  4. #3
    Senior Member Holokai's Avatar
    Join Date
    Sep 2004
    Location
    Honolulu, HI
    Posts
    127
    Member #
    7707
    Aha! thanks again Echo. I was just using what I knew about PHP to make the ASP work... Silly of me. Got it now. I actually have a book but I managed to get bored reading through it and started skipping to the info I needed as I needed it.

    - C
    -----------------------------------------------
    I know just enough to be dangerous to myself and others around me... I'm more of a CSS kamikaze than a CSS ninja...

  5. #4
    Senior Member echoSwe's Avatar
    Join Date
    May 2004
    Posts
    332
    Member #
    5926
    Hehe, np! I'll check the parametized sql out.

  6. #5
    Junior Member
    Join Date
    Apr 2006
    Posts
    2
    Member #
    13026
    Hi,

    TRy this Title:"Develop your own Web Accounting Application in ASP.Net"
    Published by VK Publishers.

    Regards
    Bhar

  7. #6
    WDF Staff Wired's Avatar
    Join Date
    Apr 2003
    Posts
    7,667
    Member #
    1234
    Liked
    141 times
    Quote Originally Posted by bhar
    Hi,

    TRy this Title:"Develop your own Web Accounting Application in ASP.Net"
    Published by VK Publishers.

    Regards
    Bhar
    are you affiliated with the publisher?
    The Rules
    Was another WDF member's post helpful? Click the like button below the post.

    Admin at houseofhelp.com


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:17 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com