I have been working on .Net platform for 2 years and right now I am working on DevExpress controls for 6 months. All these control have client-side Events which are under some ClientScript nameSpace of particular control, Which specify ClientInstanceName, methods and properties accessible at client side.
For example Button1 is ClientInstanceName and Button1.Text is a property, with methods like these:
Button1.SetValue();
Button1.GetValue();
In ASP.Net Controls, buttons have the ClientClick event that fires before the Server Side Click event.
I have inspected and goggled to extend client side functionality in asp.net controls. For example: create a ClientInstanceName property for controls or CheckedChanged event for CheckBox / RadioButton control.
I have tried using these MSDN articles:
Injecting Client-Side Script from an ASP.NET Server Control
Working with Client-Side Script
I got much information and ideas from these articles on how to implement/extend these. All are working in the client side.
protected override void AddAttributesToRender(HtmlTextWriter writer)
{
base.AddAttributesToRender(writer);
string script = @"return confirm(""%%POPUP_MESSAGE%%"");";
script = script.Replace("%%POPUP_MESSAGE%%",
this.PopupMessage.Replace("\"", "\\\""));
writer.AddAttribute(HtmlTextWriterAttribute.Onclick, script);
}
Here It is just setting up attribute to the button. but all client side interaction no control from server.
Here is that I want to know:
How can I implement such functionality to create methods, properties etc. on client side.
For example I am creating a PopControl as in the above code snippet same behavior as like Ajax ModalPopupExtender That have OK Button related properties. Ajax Controls can be directed to perform work from server side code e.g. Popup1.show(); How can I do this with such client enabled controls implemented controls as windows do?
I am learning creation of Ajax Controls but I do not want to use ScriptManager or depend on another control. Just some extension to standard controls.
I am expecting for ideas and implementation methods for such functionality.