0

I'm working on a WebControl with some AJAX functionality.

I have a control derived from System.Web.UI.WebControls, which registers the control's javascript with ClientScript.RegisterClientScriptResource. How should I go about actually getting a javascript object instantiated when the control is used on a page, and how to I get the initial data into the object?

1 Answer 1

1

From what it sound like what you are trying to achieve, I would highly recommend using the ASP.NET AJAX framework for creating these controls, as they've already built the architecture you are suggesting.

I wrote a series on using the framework, available here:

Sign up to request clarification or add additional context in comments.

5 Comments

So deriving from IScriptControl is the proper method to use? I wasn't sure if that would give me unneeded bloat if I'm already using jQuery, or if maybe the whole thing was obsolete.
Inherit from ScriptControl, which does a lot of the plumbing for you. It's not obsolete; a lot of vendors use it or a similar framework design, when designing components for web forms. There is some bloat, especially if you use the AJAX control toolkit. However, they have added some lazy loading capabilities that have been designed to offset that.
Edit: was writing this before I saw your reply: So by deriving from IScriptControl I would have to use the Microsoft Ajax Library, right? Which according to visitmix.com/writings/… has been obsolete for a while - or am I misunderstanding something in the nomenclature? I'm fairly new to ASP.net / web dev so forgive me if there are common knowledge things which I'm missing :)
No, not the Microsoft AJAX library; that was something else.
You can also use JQuery within an ASP.NET AJAX component with no problems. I wrote an article on that, as mentioned above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.