Who Is Looking: Building a Custom ASP.NET Control that uses Javascript, Cascading Style Sheets, and Ajax

Sign in to queue

The Discussion

  • User profile image
    FOR

    After 2 days of scavenging the web for info on the topic of RegisterClientScriptResource and RegisterClientScriptInclude I am doing the rounds and sharing what I discovered with the people that posted on the same topic:

    RegisterClientScriptInclude will not work unless your page has a <form runat='server"> somewhere.

    Hope this helps all the people having problems with these new APIs,

    /cheer

  • User profile image
    Mark Farina, Jr.

    Man...this was a nice article! You just helped me solve a STUPID problem I was having!

  • User profile image
    Sarah

    I tried adding the css in headers as

    this.Page.Header.Controls.Add(cssLink);

    But i get an error saying :

    System.Web.HttpException(0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)

  • User profile image
    Perrin

    Out of curiosity, after looking at the source, how does locking the thread make the generic dictionary an application level object? (it seems to be the same object throughout all user's request)

  • User profile image
    chuck

    The control doesn't render the css at design time.

  • User profile image
    Chris Lively

    Great, simple, easy instructions.

    Thanks!

  • User profile image
    Chris Lively

    When using the GetWebResourceUrl method in combination with creating an HtmlLink and adding it to the page header, how do you prevent duplicates when they have placed more than one of your controls on the page?

    Thanks

  • User profile image
    Darrell

    Great article Stephen!  It provides just the right amount of detail for me to really get started with custom controls.

  • User profile image
    Nirvana

    Great archive. I like books writed by Stephen.

  • User profile image
    Hank

    Great article. You clearly explained the why's and how's of some important pieces required to build server controls.

    Thanks!

  • User profile image
    Clint

    @Al:  Stepping back and thinking about it, I think you could but would require you to do stuff with the global.asax file for your web app and then from there keep an up to date tracking.

    I haven't tried to do this however yet.  Seems do able.

  • User profile image
    Al

    Is it possible to use control to watch who is looking other pages, not page with control? How to pass page into whoislooking page?

  • User profile image
    F.T.

    Man you made my day, great article indeed.

  • User profile image
    Sharad

    Thanks!!

    Nice article..

    I will tried it out with my requirements today..

    Many Thanks

  • User profile image
    zedfox

    very very nice and handy article....

Add Your 2 Cents