Creating a custom control in asp.net that has javascript properties and methods?

It is very possible. I have a class CalledCustomControlLibrary. It contains several folders which include images and scripts.

You can include those types of items using assemply: WebResource IE assembly: WebResource("CustomControlLibrary.LeftRight. Local_img.leftArrow. Jpg", "img/jpg") assembly: WebResource("CustomControlLibrary.LeftRight.

Local_img.rightArrow. Jpg", "img/jpg") assembly: WebResource("CustomControlLibrary.LeftRight. Local_js.leftright.

Js", "application/javascript") assembly: WebResource("CustomControlLibrary. Global_js. Jquery-1.3.2.

Js", "application/javascript") assembly: WebResource("CustomControlLibrary. Global_js.mousehold. Js", "application/javascript") Then in the onload event of the class you can register the client scripts like: string tsJQueryJS = Page.ClientScript.

GetWebResourceUrl(this.GetType(), "CustomControlLibrary. Global_js. Jquery-1.3.2.

Js") ; string tsMousehold = Page.ClientScript. GetWebResourceUrl(this.GetType(), "CustomControlLibrary. Global_js.mousehold.

Js"); string tsLeftRightJS = Page.ClientScript. GetWebResourceUrl(this.GetType(), "CustomControlLibrary.LeftRight. Local_js.leftright.

Js"); if (!Page.ClientScript. IsClientScriptIncludeRegistered("JQuery" )) { Page.ClientScript. RegisterClientScriptInclude("JQuery", tsJQueryJS); } if (!Page.ClientScript.

IsClientScriptIncludeRegistered("Mousehold")) { Page.ClientScript. RegisterClientScriptInclude("Mousehold", tsMousehold); } if (!Page.ClientScript. IsClientScriptIncludeRegistered("LefRightJS")) { Page.ClientScript.

RegisterClientScriptInclude("LeftRightJS", tsLeftRightJS); } The entire control is housed simply in the class. Which inherits WebControl and IPOstBackDataHandler. This control in particular is for a control that has a left and right arrow button and increments or decrements the number value in the text box based on holding the buttons.

Yes, you want to look at JavaScript class development like this as one example (there are others): howtocreate.co.uk/tutorials/javascript/o... You may really want to look at developing ASP. NET AJAX controls, which integrate server-side controls and AJAX capabilities. I developed a few and I have written a few articles on this subject: devproconnections.com/article/aspnet2/re... devproconnections.com/article/aspnet2/Bu... devproconnections.com/article/aspnet2/aj... For JQuery, use this: Plugins: http://docs.jquery.com/Plugins/Authoring Widgets: http://docs.jquery.com/UI_Developer_Guide HTH.

Thanks for the links, unfortunately I can't use the AJAX control toolkit. With regards to objects in Javascript, I understand how they work, but I don't know how to associate them with my custom control. Do you have any ideas on that?

I want to be able to do $('#myCustomControlID').increment(); if possible. – SLC Feb 23 at 16:45 The syntax you provided is a JQuery plugin or widget, edited response above. – Brian Mains Feb 24 at 1:49.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions