ASP.NET Connections Tips and Tricks Slides+Demos Posted

I'm about to head downstairs for my ASP.NET Tips and Tricks talk at ASP.NET Connections in Orlando.  I'm talking about and demoing a number of nice new things in ASP.NET 2.0 that make web development easier:

  • App_Offline.htm
  • Cross Page Post-backs
  • Validation Groups
  • Maintaining Scroll Positions
  • Control Focus, Default Buttons, Error Focus
  • Client Scripting and Client Confirmations
  • Data-binding Expressions
  • Config-based Control Registration
  • CSS Control Adapters
  • RSS Feeds and Subscriptions

You can download my slides + samples here.  Each sample above has a sub-directory containing a sample showing it off (note: the one exception is the CSS Control Adapters -- which I will be demoing, but which won't ship on the web until later this month).  

Hope this helps,

Scott 

23 Comments

  • Thanks Scott. Great presentation today. I presume that nearly all of the things you presented were available to use in the WAP as well.



    I did subscribe to bloglines...seems like a great little service. A lot better than the rudimentary one that I built over a year ago... :)

  • Thanks for your demo and I've one question on Cross Page Post-backs. As I can see from many of the examples shown about cross page postback, it only involves basic controls like button or textbox to be found in the 2nd page. How can I access the value in more complex controls like gridview using cross page postback? It'll be good if you can provide another tutorial about this. Thanks a lot!

  • Great session today! And thanks for posting the code.



    You guys have me all riled up about 2.0.

  • I hope you may be able to make a video available on MSDN - the talk looks interesting but it's a few thousand miles away so I can't attend!

  • Maybe its just me but trying to use the cross page post-back feature with master pages turned out to be a bit of a pain. It is doable but after using hacks mentioned on various forums like having get methods which expose controls from the previous page and so forth. Even then you run into problems down the line.



    I ended up doing the old same back postback and then redirecting to other page with variables in querystring. sigh* I am sure there has to be a better way.

  • Scott,



    thanks for the slides! It's a great summary for the new features asp.net 2.0 has to offer. I learned something new today such as the default focus. Is there a way to disable focus? I have a long page and the form is at the very bottom of the page. Evey time the page load it automatically scroll down to the form because the focus was set on the text box. Netscape and firefox don't have this problem. I didn't set the focus at all but is there a way force it disable? I am not sure if this is off topic I am certainly appreciate any help!

  • Scott, thanks for the demos. There are several little things in here that I had now idea exisited and they help streamline several areas of my apps.



    Quick question: I've been using maintainScrollPositionOnPostBack for a while and it generally works as advertised. However, it doesn't maintain the scroll position for elements such as DIVs. Also, while it generally keeps the scroll position for listboxes, I often find that on large pages with several boxes, there are always a couple that loose their position on postback. Any ideas?

  • Thanks those are really good examples. Really good examples. Your blog is becoming required reading.



    Thanks again!!!

  • Is the link going to be made active again? I see it's spewing a 404 error

  • I've seen a few reports that the link wasn't working. I think it is working now, but if not please send me email (scottgu@microsoft.com) and I'll send it to you directly.



    Thanks,



    Scott



  • Scott, thanks for the demos

  • RegisterStartupScript and RegisterClientInclude are nice, but they both seem to put their script code inside of the ASP.NET <form> tag. Is there an easy way get script code or an include added in the <head> block? Am I missing something easy?

    -Steve

  • About the new way to register controls in the web.config...

    -can both user controls (ascx) and custom server controls be registered?

    -what are the pros/cons of this way to register controls?



    -Raul

  • Hi Raul,



    You can register both custom controls and user controls now within web.config files. There aren't a lot of cons I can think of -- it can be super handy.



    Hope this helps,



    Scott

  • Thanks Nik. Just looked at it. Maybe I was missing the <%@ PreviousPageType VirtualPath="~/Source.aspx" %> in the target page but its been a while so can't remember.

  • The download link appears broken. Instead of downloading a binary .zip file, it streams the file as text. :-(



    - DrJazz

  • Hi DrJazz,



    Unfortunately my server's hard-drive just crashed and is being restored. If you want to send me email (scottgu@microsoft.com), I can send it to you in the meantime.



    Thanks,



    Scott

  • I was able to download it fine today. Thanks Scott!!



    - DrJazz

  • Hi there !
    I am having trouble trying to make a Listbox ASP.NET web control maintain scroll position after postback - in 2.0. I tried SmartNavigation, MaintainScrollPositionOnPostBack which according to my understanding should preserve the scroll position only for the whole web page. I tried also some Jscript code with the RegisterClientScriptBlock function, but nothing seems to work. I think the reason is the JScript code does not recognize my control.
    I am not so good with JScript. Can anybody help me ? Thanks a lot.
    Ovidiu

  • Do you have any code sample for maintaing the scroll position for individual controls, I would like to have a web form with numerous listboxes that all maintain their individual scroll positions

    Many thanks

  • Hi Mike,

    Unfortunately I don't have a particular sample that shows how to-do this. :-(

    Sorry!

    Scott

  • Hello !

    Slides are very helpful.

    I've one problem related to tab index.
    I've few controls on my webpage. I've set tab index for all control.
    Its working fine. But if click scroll bar of my web page and then press tab key then focus goes to first control.
    I want it to go on next control.

    Will you please tell me how to overcome this problem.

    Thank You.

  • Hi Sonali,

    I believe this is controlled by the browser. So you might need to write some custom JavaScript in order to change the order.

    Hope this helps,

    Scott

Comments have been disabled for this content.