Creating Server Controls with Ajax Capabilities

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    Creating Server Controls with Ajax Capabilities

    Server Controls with Client Capabilities (Ajax)

    It can be extremely difficult to manipulate the client aspects of your web server controls using server code alone. In fact it's impossible to do some things with server code alone. In these cases, ASP.NET developers turn to JavaScript for help.

    But, sometimes it's not enough for your control to just call a JavaScript function that does something. In some cases, your control needs to know what was done while it existed in the web browser. In order to do this, your control needs to be represented as a JavaScript Object as well as a .NET Object.

    So, you need create two components to your control: the .NET server code that contains the class information for your server control, and the JavaScript client code that also contains class information about your control. The nice thing is that .NET provides a template that you can use to create the JavaScript Object: the AJAX Client Control. When you add an Ajax Client Control to your project, it creates a skeleton JavaScript class that uses the ASP.NET Ajax Libraries. (If you are unfamiliar with JavaScript Objects you should probably familiarize yourself with them now because things are going to be confusing for you if you don't understand these) Please note that the ASP.NET Ajax Libraries are added to the page by the ScriptManager control. This means that your control will require a ScriptManager to exist on the page in order for it to work.



    Now you know that you need two classes (one for each environment); but, how do get these two classes work together? You need a way for your server and client code to be able to transfer information too each other. This is made possible by implementing the IScriptControl Interface.

    Ok, enough background information on what these controls are and why they are needed.
    Let's further explain them using an example so that you can see how cool they are!

    Example

    Say you want to expand on a regular ASP.NET Panel.
    ............... ...










    Help
    More Help
    ASP.NET Ajax Library Documentation
    DOM
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    Since you are not getting any feedback at all from anyone concerning the many articles you have been writing, why do you keep writing them to post on bytes? There are many forums where articles like you have been writing would be very well appreciated. Might even lead to some opportunities for you.

    I feel a bit ashamed that the bytes membership, especially staff, is pretty much ignoring you, not even words of encouragement or appreciation.

    Is your connection/relationship with this forum more than just as a moderator?

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      Originally posted by KevinADC
      Since you are not getting any feedback at all from anyone concerning the many articles you have been writing, why do you keep writing them to post on bytes? There are many forums where articles like you have been writing would be very well appreciated. Might even lead to some opportunities for you.
      I don't do it for the recognition.

      I do it because the topics I cover haven't been adequately covered on the net . The stuff I write about is all over the place in pieces but never cover the whole picture.

      Originally posted by KevinADC
      I feel a bit ashamed that the bytes membership, especially staff, is pretty much ignoring you, not even words of encouragement or appreciation.

      Is your connection/relationship with this forum more than just as a moderator?
      I'm saddened by what bytes has become over the last while. It used to be a vibrant community that produced some amazing conversations/insights which I could learn from. Lately the forums I participate in feel like they're "ask Frinny" hotlines. I really miss what bytes used to be.

      Bytes is the first real forum I've been involved in. I've only recently turned to another forum to get what I used to get from here.

      I'd love to see Bytes return to what it was as theScripts.
      I hope that my articles can attract some new members.

      There's no encouragement here...but hey, that's not why I do things.

      :)

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Hmmm I'm tempted to let this article die.
        I'm not excited this technology anymore....in fact I think it's rather clumsy now....

        Comment

        • KevinADC
          Recognized Expert Specialist
          • Jan 2007
          • 4092

          #5
          Well, I hope you are having some fun and also learning while writing your articles. I know they can be time consuming if you want to do a good job and make sure they are accurate and relevant. You should consider posting them on other forums where they should get more attention and believe me, you will enjoy if people start giving you feedback or asking questions.

          Anyways, keep up the good work.

          Kevin

          Comment

          Working...