JavaScript & ASP.NET Controls - Possible?

Results 1 to 4 of 4

Thread: JavaScript & ASP.NET Controls - Possible?

  1. #1
    Join Date
    Dec 1969

    Default JavaScript & ASP.NET Controls - Possible?

    I haven&#039;t yet delved into ASP.NET web application development but am halfway through Wrox&#039;s Beginning ASP.NET book. I&#039;m experienced in classic ASP apps, and have always tightly integrated client-side JavaScript functions into my web apps.<BR><BR>From the looks of things, ASP.NET wants me to start using Asp: controls, thereby "eliminating" my use for client-side validation and scripting. Well, there are certainly points where I would want to use the OnClick event on an HTML control to make other things happen in the client, such as changing an image&#039;s or checkbox&#039;s state, to name a simple and common example, without posting back to the server.<BR><BR>Does ASP.NET lend itself to doing this without posting to the server? Please answer in-depth as to how I would go about doing this, and provide me any examples that you have handy. I have not seen any articles on Rolla and other sites on this issue, but if you have, point me in that direction.<BR><BR>Thanks for your time,<BR>Dave Artz -

  2. #2
    Join Date
    Dec 1969

    Default Yes and no

    There are options for most server controls to put the JavaScript client side. However, I don&#039;t particularly care for server controls as I think they are a bit of a hassle. Here is what I like to do instead:<BR><BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: JavaScript & ASP.NET Controls - Possible?

    Nothing has changed in terms of what you can do with HTML elements and javascript (obviously) and, as in the past, you SHOULD ALWAYS do as much work in the clients browser as you can.<BR><BR>ASP.NET has helped to create the *illusion* that it&#039;s ok to just keep posting back to the server whenver you have some minor task to perform, but it&#039;s not the case in reality.<BR><BR>Read this article to learn how to attach client-side behaviours to ASP.NET server controls:<BR><BR><BR><BR>In addition to that, you can still use all of your old favourite *tricks* such as storing information in hidden fields while you are doing client-side data processing.<BR><BR>Good Luck

  4. #4

    Default Encapsulate not eliminate

    The server cotrol should encapsulate your functionality.<BR>It should eliminate the need to add additional javascript because it&#039;s javascript is included.<BR><BR>The postback approach is the lowest common denominator, html 3.2, and do the "fancy stuff" on the server.<BR><BR>You can write your controls to server browser specific HTML.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts