Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

ASP.NET n00bie....

Options
  • 04-04-2008 3:09pm
    #1
    Registered Users Posts: 87 ✭✭


    Time to get my skills up to date, alas.

    I'm well experienced in developing with classic ASP, but I've yet to have that "eureka" moment with ASP.NET - there's a lot about it that, for some reason, I just don't get - it seems to work very differently to classic ASP.

    Any .NET developers here care to share their "eureka" moment or share any tips for someone migrating over from classic ASP?

    I'll be sticking with VB.NET rather than going the C# route, I think.


Comments

  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Don't dismiss C# just yet, its easier than you think and a lot less verbose than Vb.net.

    What exactly are you find difficult with asp.net? You should probably buy yourself a good primer for Classic Asp developers.


  • Registered Users Posts: 87 ✭✭Teh Russ


    I just have a bit of a phobia about languages with lots of semicolons and curly brackets. :D Besides, I figure, since I'm already pretty decent with VBScript, it's not a huge leap to using VB.NET.

    Any suggestions for a good primer for classic ASP developers moving to .NET?


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    Evil Phil wrote: »
    Don't dismiss C# just yet, its easier than you think

    Especially if you have any JavaScript experience...

    It can take a while to get used to alright. I think one of the hardest things for me was learning to separate my presentation and functionality - i.e. referencing server side control properties in your HTML rather than putting response.writes everywhere.

    e.g. instead of:
    <&#37;
    Dim sUsername
    sUsername = "whatever"
    %>
    Welcome <%=sUsername%>
    

    You have:
    [html]
    <form id="form1" runat="server">
    <div>
    Welcome <asp:Label ID="lblUsername" runat="server" Text="Label"></asp:Label>
    </div>
    </form>
    [/html]
    ...
    protected void Page_Load(object sender, EventArgs e)
        {
            string Username = "whatever";
            lblUsername.Text = Username;
        }
    

    Did you ever use classes in ASP or was it all linear type scripting?


  • Registered Users Posts: 87 ✭✭Teh Russ


    Rarely... used functions and subs regularly, but rarely anything that could be called a class - that was a little too close to C for my liking. :D

    Looks reasonable enough... but what do the parameters in the first line of the Page_Load class mean (object, sender, EventArgs e)? It's things like this that confuse me (functions and subs in VB.NET appear to have those too).


  • Registered Users Posts: 515 ✭✭✭NeverSayDie


    Looks reasonable enough... but what do the parameters in the first line of the Page_Load class mean (object, sender, EventArgs e)? It's things like this that confuse me (functions and subs in VB.NET appear to have those too).

    The Page_Load method is an event handler, called/triggered when the page is loaded. Those parameters will usually be found on any event handler, the "sender" one is the control/object that triggered the event, and the EventArgs type parameter will contain any extra arguments that were passed along.

    Here's an example of using the "sender" object to access the control that triggered the event (in this case, on a button click, not a page load):
    http://msdn2.microsoft.com/en-us/library/zk6b17bs(VS.80).aspx

    More detailed explanation of the event-based stuff here:
    http://msdn2.microsoft.com/en-us/library/y3bwdsh3(VS.80).aspx

    I've never used classic ASP myself btw (came into ASP.NET from a LAMP background), so I'm not sure how this stuff differs/relates to what went before. Quite a bit, from what I gather.


  • Advertisement
  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Rarely... used functions and subs regularly, but rarely anything that could be called a class - that was a little too close to C for my liking.
    Well VB.net and C# are both object oriented programming languages so you can't avoid that, and the curly braces and semicolons or par for the course as a programmer - start getting used to them.

    From working with both (and I came from primarily a vb6 background) I would say that the learning curve for the syntax of C# might be a little longer for you the learning curve for both languages will be the same, C# might even be a shorter. VB.Net is very verbose imho, I've found three different ways to cast so far, with C# I've only ever had one. Plus the event lifecycle and wire ups in vb.net seem overly complex in comparison.

    If you've done any windows development with vb then you could consider asp.net pages to be similar in a way. You have your form with its elements (the aspx page) and then you have your code with your events, functions and subs (the code behind).


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    If you have ever programmed VB6 you should be fun. You will understand onClick onLoad events etc..

    In classic ASP you could check if you posted back to the page you could do the following
    If Len(Response.Contents) <> 0 Then
    
    End if
    

    In ASP.NET is If Page.IsPostBack

    So most of the stuff is there, you just need to learn to the new way..

    Classic ASP was linear in its execution, ASP.NET is function based, you can still make it linear if you wish.. not the best tho!!!


  • Registered Users Posts: 339 ✭✭duffman85


    The ASP .NET website has a few video tutorials here which might help you a bit. Those are fairly general. This one is for people migrating from ASP to ASP .NET.


  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    Tbh I'd suggest either looking up beginners tutorials on the net or getting a good beginners book. I know you've a lot of experience with ASP, but .Net is different enough that I think you will be best served by going back to the very start (as in "hello world") and working right the way through it.

    The good news is that with your ASP background you should fly through it pretty quick. The concepts of object orientated programming might take a bit of time to grasp, but the rest of it will be fairly straightforward. In fact with a good grounding in ASP you should end up with a much better grasp of what's going on in ASP.Net than someone who started in ASP.Net, you'll be easily able to spot where it's automating processes you used to code manually, how the postbacks work, how the server controls are really just rendering html, how the event and page lifecycle models work etc.

    Nothing wrong with sticking with VB.Net for now. While it's very different in some structural ways to VB, at least a lot of the syntax is the same or similar, a for loop is still a for loop etc. You'll be able to read code samples easier and write your own stuff quicker. And once you're familiar with VB.Net switching to C# is pretty easy (structurally the same as VB.Net with different syntax).


  • Moderators, Science, Health & Environment Moderators Posts: 8,951 Mod ✭✭✭✭mewso


    Evil Phil wrote: »
    VB.Net is very verbose imho, I've found three different ways to cast so far, with C# I've only ever had one. Plus the event lifecycle and wire ups in vb.net seem overly complex in comparison.

    If thats as serious a problem as you can find with vb.net then it can't be that bad :) Either is good. I am a vb.net man but I am thinking of switching to c# some day soon as I find myself writing alot of javascript these days and it would be nice not to have to switch brains each time.


  • Advertisement
  • Registered Users Posts: 2,931 ✭✭✭Ginger


    I switched from VB.NET to C# as it was the language that 90% of the team used so for code clarity I am using it. Didnt find the switch any way difficult except with my variable declarations because I am used to Dim variable As string as compared to string variable... It was a purely oops type then name rather than name then type!


  • Registered Users Posts: 2,494 ✭✭✭kayos


    C# is so much nicer to read than VB.NET. I was a VB6 dev for years and when we where moving over to .NET the choice was mine as to what to go for. I took one look at VB.NET and nearly died at the verbose syntax. Any way if you want to learn something thats of value in industry then C# would have way more market value to you.

    As for the swap from ASP to ASP.NET....I had more problems coding in ASP than ASP.NET honestly ASP.NET is just like your old VB6 forms. Drop a control on the form, wire up the events, code them up and hey presto.


  • Registered Users Posts: 9,557 ✭✭✭DublinWriter


    kayos wrote: »
    As for the swap from ASP to ASP.NET....I had more problems coding in ASP than ASP.NET honestly ASP.NET is just like your old VB6 forms. Drop a control on the form, wire up the events, code them up and hey presto.
    Yes and no.

    There's still a lot of overhead in using the formview control in terms of form design; you're basically designing one template for the view and another for editting/inserting.

    I've heard that there's also numerous binding problems that still remain unfixed in VS2005?

    While it's still a nice-environment, it's light years behind what I could do with Delphi six years ago. Maybe that's why MS poached Borland's lead tech architects in 2002?


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    I would say in asp.net the binding is spot in and incredible powerful. Its not simple though. I haven't run into any problems yet and traditionaly I hated databinding. Probably because I considered lazy but mostly because it abstracted control out of my hands. Not so with VS2005. Can't speak for windows forms however. What are these problems though? Perhaps we can help.


  • Registered Users Posts: 2,494 ✭✭✭kayos


    Since when did "wire up the events" become data binding?

    I was just talking about the simple way you can code up events for the different controls. The only binding I tend to use in ASP.NET would be for simple lists.

    But hey dont listen to me in terms of UI development, I'm mainly reside in the depts of a database or in the backend side of coding. Apart from a few bits the UI realm it not my main area. I remember the days when AJAX wasn't called AJAX and it was all custom coded, I believe one company I worked for is still using all the AJAX controls and framework I built for them back way back when.


  • Registered Users Posts: 87 ✭✭Teh Russ


    Thanks for your advice, everyone. I've got a big, 3-inch thick book on ASP.NET sitting next to me here, so that should last me a few months. :D

    If I can't get the hang of it, I can see myself giving up and switching to JSP... there seems to be loads of good-paying JSP jobs around right now!


  • Closed Accounts Posts: 18,056 ✭✭✭✭BostonB


    Yes and no.

    There's still a lot of overhead in using the formview control in terms of form design; you're basically designing one template for the view and another for editting/inserting.

    I've heard that there's also numerous binding problems that still remain unfixed in VS2005?

    While it's still a nice-environment, it's light years behind what I could do with Delphi six years ago. Maybe that's why MS poached Borland's lead tech architects in 2002?

    I'm only new to ASP.net but what do you mean. I only use one form for view, edit and insert. Pass a parameter to switch the mode/buttons of the form. Maybe thats a bad way or something.


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    BostonB wrote: »
    I'm only new to ASP.net but what do you mean. I only use one form for view, edit and insert. Pass a parameter to switch the mode/buttons of the form. Maybe thats a bad way or something.

    I would also use the same form for edit and insert, but the view page could well have a completely different layout, so I would keep that separate, especially as that may be handed over to a designer for changes. It's also probably good practice to keep the public pages different to the private pages.


  • Closed Accounts Posts: 18,056 ✭✭✭✭BostonB


    Its not really on topic for this thread but why is a good idea to have a different page layout from edit to view. If there was an advantages in editing the information in a different view, fair enough. But otherwise why? Equally there could be advantages in having it the same. WYSIWYG etc.

    DublinWriter suggests it can't be done. What does he mean by this?

    Yes a designer. Be nice that. :)

    Never mind hes asked it here
    http://www.boards.ie/vbulletin/showthread.php?t=2055272297


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    He's referring to the FormView control which is a databound control, not the web form itself.


  • Advertisement
  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    BostonB wrote: »
    Its not really on topic for this thread but why is a good idea to have a different page layout from edit to view. If there was an advantages in editing the information in a different view, fair enough. But otherwise why? Equally there could be advantages in having it the same. WYSIWYG etc.

    It depends. If you are doing something like viewing a person's details in an in-house application, then you would probably just be replacing input fields with labels - that's not a big problem.

    But if it's something like a CMS for an externally facing website, then the view page could have a completely different layout when viewed, and it may not make for a usable edit page.


Advertisement