ASP.NET from Scratch : Lesson 2

ASP.NET from Scratch: Lesson 2

Nov 30th, 2009 in ASP.NET, Screencasts by Jeremy McPeak

Continuing on from lesson one, Jeremy McPeak, author of Professional AJAX, and Beginning JavaScript: 4th Edition, will take things a step further as we delve deeper into working with the ASP.NET framework.

PG

Author: Jeremy McPeak

I started my development career on the client-side writing JavaScript and DHTML components in my spare time. In 2005, Nicholas C. Zakas asked me to join him in writing the first edition of Professional Ajax for Wiley Publishing. Since Professional Ajax, 1st Edition, I've been blessed to take part in other book projects: Professional Ajax 2nd Edition, and Beginning JavaScript 3rd and 4th editions.

The Complete Series

Screencast

Other Viewing Options


Related Posts

Check out some more great tutorials and articles that you might like

Enjoy this Post?

Your vote will help us grow this site and provide even more awesomeness

Plus Members

Source Files, Bonus Tutorials and
More for $9 a month for all TUTS+
sites in one subscription.

Join Now

User Comments

( ADD YOURS )
  1. PG

    Bleyder November 30th

    No FLV Version?

    ( Reply )
    1. PG

      Jeffrey Way November 30th

      The version above is FLV.

      ( Reply )
      1. PG

        Bleyder December 10th

        Hi Jeffrey. I meant a direct link to a FLV version of the video like in the previous lesson.

  2. PG

    Shote November 30th

    Thank you.. keep them coming. Good work!

    ( Reply )
  3. PG

    TJM November 30th

    Don’t use asp:Panel as they usually render as divs – use asp:Placeholder for a cleaner option.

    ( Reply )
    1. PG

      Jeremy McPeak November 30th

      The Panel and PlaceHolder controls serve two different purposes – much like the Label and Literal controls.

      My use of Panel controls in EmailForm are correct – they contain markup and other controls. If I wanted to dynamically add the markup and controls to the page, the PlaceHolder would be the correct control to use.

      Correct use aside, I wanted a element. Why use a PlaceHolder if you’re going to contain everything in a element anyway?

      ( Reply )
      1. PG

        Jeremy McPeak November 30th

        Oops, that last paragraph should read:

        Correct use aside, I wanted a div element. Why use a PlaceHolder if you’re going to contain everything in a div element anyway?

      2. PG

        TJM December 1st

        If that’s what you wanted to achieve then that’s great as you are in control of everything, but I’m not too keen on relying on a dynamically generated Id, especially one with and Id of “pnlSuccess”.

        For me a cleaner option is to use my own markup wherever possible with .NET – maybe just a habit I picked up since working with it since version 1.1 (when by default .NET rendered asp:Panels as table elements in non-IE “downgraded” browsers) and working in teams with roles that divide the presentation with the business logic.

        Lovely and methodical tutorial BTW!

  4. PG

    sasa November 30th

    Nice,
    thanks for lesson #2!

    ( Reply )
  5. PG

    TJM November 30th

    Don’t use asp:Panel as they usually render as divs – use asp:Placeholder for a cleaner option.

    ( Reply )
    1. PG

      Jeremy McPeak November 30th

      See above.

      ( Reply )
  6. PG

    Staggo November 30th

    Thanks for that!!!

    ( Reply )
  7. PG

    pelumi November 30th

    ‘am glad this is finally out

    ( Reply )
  8. PG

    Bruno November 30th

    Great.
    Finally some Asp.net articles;)

    Waiting for more.

    ( Reply )
  9. PG

    Nick November 30th

    So glad that the second lesson is finally here… Those are really helpful!!!
    When is the next one coming out?

    ( Reply )
  10. PG

    Maran November 30th

    I am .net developer. Its good have atleast few ASP.Net artticles. Thanks guys

    ( Reply )
  11. PG

    YrZ November 30th

    ASP sucks, learn php :)

    ( Reply )
    1. PG

      Jeremy McPeak November 30th

      I agree. ASP sucks. ASP.NET is much, much better, and in my opinion, it’s better than PHP (I used to be a PHP guy).

      ( Reply )
      1. PG

        Zoran November 30th

        Could you please answer my question from bellow about the difference and how hard (long) is to learn ASP.NET if you are very good in PHP? I am using PHP for about year and a half and came to a conclusion that i can be very limited when it comes to making some complex stuff. I agree with you, some people are just too proudly ignorant that they don’t even know that ASP is different thing from ASP.NET :) . It’s a fact that if you know more it’s better for you, so don’t be discouraged by bad comments, just keep up the good work, some people want to learn instead to fight what is better.
        @YrZ, try ASP.NET, use it for a while, then judge it… didn’t they teach you that prejudice is a bad thing? I love PHP a lot and did almost anything with it, but i am not married to it :D

      2. PG

        Jeremy McPeak November 30th

        I was typing out a short reply as you replied here =)

  12. PG

    Sergio November 30th

    around min 7 i think he said control like 10 times. still very helpful to understand controls.

    ( Reply )
  13. PG

    Zoran November 30th

    Could anybody, please tell me how hard is to learn ASP.NET if you are very good at PHP and what are the advantages of using ASP.NET over PHP? I am PHP lover, but i think that being familiar with more programming languages always is a good thing. Thank you for your video Jeremy, i am going to give it a try to learn at least the basics.

    ( Reply )
    1. PG

      Jeremy McPeak November 30th

      The two most challenging aspects of learning anything .NET, in my opinion, are:

      1. Getting familiar with with the classes in the Framework Class Library.
      2. Learning and getting comfortable with object oriented programming (if you don’t have any OOP experience).

      I can only speak from my experience, but the only problem I had in switching to ASP.NET with C# from PHP was finding decent online resources (I switched in 2003). That’s not much of a problem these days.

      The first part of this series covered some of the advantages. It’s by no means an exhaustive list. Something I didn’t put into that list is flexibility. One thing I hate about PHP is being completely dependent on the PHP installation in a shared-hosting environment. Unless you have a very generous host, you’re out of luck if you want to use extensions or third party components that require you to recompile PHP.

      With ASP.NET, using extensions or third party components is typically completely in your control. You simply add a reference to the components/extensions in your project, upload the DLLs, and you’re ready to roll. There are some exceptions to this; nothing requires a recompilation of .NET on the server, but some components do have to be installed on the web server in order to work correctly. MySQL’s Net Connector is one such component that has to be installed in order to take advantage of all the features.

      ( Reply )
      1. PG

        Zoran November 30th

        Thank you for your answer, i am bit familiar with Visual Basic, Java and very much with OOP PHP, which i prefer over procedural way of coding. I think i will give it a shot to ASP.NET, not soon, but i downloaded both of your videos and will have a look when i have more free time. I won’t either have problem with databases, cause i have degree in Databases structures and never had problems switching from MySQL to something else, cause SQL as we know is same for each model. Also thanks for mentioning C#, that’s on my list too and keep up the good work… Variety and having multiple choices is always a good thing.

  14. PG

    Torsten November 30th

    I need new CI from Scratch Lessons and i have an Idee for the next from Scratch Lessons Java!!!

    ( Reply )
  15. PG

    Matt November 30th

    I was waiting for this for weeks. I haven’t watched it yet, but THANK YOU for putting this up.

    ( Reply )
  16. PG

    Chris November 30th

    So the code in btnSubmit_Click runs before Page_Load, correct? Or what’s the order there?

    Wow, I didn’t realize Server 2008 was free for students. What’s the difference between 2008 and 2008R2?

    ( Reply )
    1. PG

      Matt November 30th

      2008R2, for the biggest improvement/hurdle, is that it is 64-bit only. It can run 32-bit apps through the WoW subsystem, but it is only 64-bit on the hardware level. It includes an updated IIS, ActiveDirectory enhancements, better virtualization support, etc.

      If you can run R2, do it instead of regular 2008. I think the only reason they have 2008 still up is for creating legacy applications designed for the 2008 platform (note, the student editions were created for studying, not for actual use).

      ( Reply )
    2. PG

      Jeremy McPeak November 30th

      Anything that causes a postback executes after the Page’s Load event. We haven’t gotten into postbacks for simplicity’s sake, but clicking the button causes a postback. So btnSubmit_Click executes after Page_Load.

      ( Reply )
      1. PG

        Chris Paul December 1st

        Awesome, thanks for your explanation. It really clears things up. Looking forward to Video 3.

  17. PG

    Ross December 1st

    Thanks a lot for the extremely helpful tutorial. I did C# ages ago, but have found that I forgot most of what I learned, and Im really eager to learn the ins and outs of the language again so that I can get serious with XNA, and also have a look at considering ASP.NET as my Web dev language of choice at work.

    Keep up the great work!

    ( Reply )
  18. PG

    Serge December 1st

    Thank you. Waiting for lesson 3 ;)

    ( Reply )
  19. PG

    Freddy Gonzalez December 2nd

    I really like this. So how would you deploy it on your server. What files and or folders do you include.

    ( Reply )
    1. PG

      Skunkie December 4th

      Simply Click “Build > Publish” and activate the “only files to run this apllication” button (select a local file path and see what happens).

      In detail

      You include:

      - the compiled .NET assemblies (the bin folder)
      - the web.config
      - static files (like .css, images etc.)
      - uncompiled aspx pages

      You do not include:

      - C# code files (including code-behind classes of aspx files)
      - Project and Solution files
      - the obj folder

      A free tool like CruiseControl.NET gives you more advanced publishing and maintanance option. You should check that for real-world apps.

      ( Reply )
  20. PG

    Vijay December 3rd

    Excellent!!! Eagerly awaiting lesson 3.
    How different is C# with .net to VB with .net ? I have to work only in VB.net, but I am relate it to what I am working on.
    Thanks and keep up the generous good work !!!

    ( Reply )
    1. PG

      Vijay December 3rd

      Sry, I mean I could relate your lesson with my work.

      ( Reply )
    2. PG

      Neil December 5th

      @Vijay, I have been using .Net for the last 4 years, I just switched from VB.Net to C# 3 weeks ago and actually prefer C# over VB.

      @Jeremy McPeak, great screen cast, very thourough.

      ( Reply )
  21. PG

    Miguel December 4th

    Awesome stuff, been waiting for this! Keep up the good work.

    ( Reply )
  22. PG

    Pete December 14th

    Really awsome series.

    ( Reply )
  23. PG

    Riya December 15th

    waiting for ASP.NET from Scratch: Lesson 3

    ( Reply )
    1. PG

      sasa December 30th

      me too

      ( Reply )
  24. PG

    abdu December 17th

    Thank you , waiting for next .

    ( Reply )
  25. PG

    lawrence77 December 17th

    both the two lessons are fantastic….

    Now only finish watching… they are stunning for the beginners….

    Jeremy u rocks….. waiting for the further lessons…

    ( Reply )
  26. PG

    spartax December 20th

    thanks for the lesson… really helpful.

    ( Reply )
  27. PG

    tobar December 29th

    please ci or php videos. i hate .net and ms. asp is a stupid language.if i were you i learn java not asp ;)

    if you learn asp.net you will pay lots of dolars for hosting and sqlserver but linux is free and more secure.

    ( Reply )
  28. PG

    George Hennessy December 29th

    @Jeremy M.

    Great job on this tutorial. How were you able to center the email form. I’ve thoroughly examined your CSS codes and did not see any code for “centering”. I’ve tried the text-align: center, but this didn’t work for me. I’m running Windows XP Pro, Internet Explorer 8 and Firefox 3. In both IE and Firefox, the email form appears to the left of the browser.

    Thanks.

    ( Reply )
    1. PG

      sasa December 30th

      this is thing what center form:

      margin: 0px auto;

      ( Reply )
  29. PG

    CharlotteqK December 31st

    With the purpose to prevent the failures in some dissertation tips, that should be better to purchase the cool research referring to this topic at the dissertation writing service in Internet. It’s not so hard to reach the PhD coming that way.

    ( Reply )
  30. PG

    sasa January 14th

    waiting for ASP.NET from Scratch: Lesson 3

    ( Reply )
  31. PG

    Peter January 26th

    Awesome lesson. I have a little bit of experience in Java and it’s nice that it has some similarities.

    ( Reply )
  1. Arrow
    Gravatar

    Your Name
    January 26th