Axial is an open-source project on codeplex. We can use it to implement Javascript in C # Or VB. NET mode, and then it will automatically output the corresponding JavaScript to the client. Some form controls can be used for input verification, some JS effects, and Ajax. Axial now encapsulates jquery, so that we can use C # Or VB. NET to use jquery.
Axial contains several server controls:
- Wfserverscript
- Wfscript
- Wfvalidator
- Wfstartupscript
- Wfclass
- Canvas
- Wfscriptbutton
Axial is easy to use:
1. Add an axial. dll reference and add the axial control to the control toolbox.
2. Write the related Javascript. Net Method in the background. The method must be public.
Using Axial;
Using Axial. jquery;
Using Axial. Dom;
Namespace axialweb
{
Public partial class jquerytest: system. Web. UI. Page
{
Protected void htmlthedivs (){
Jquery. jquery ("Div. Empty" ).html ("in a div ");
Jquery. Get ("viaajax.txt", "", (response) =>{ jquery. jquery ("Div. Empty: First" ).html (string) response );});
Jquery. jquery ("Div. notempty" 2.16.children().html ("when two divs love each other very much ");
Jquery. jquery ("Div. notempty" ).children().css ("padding", "3px ");
Jquery. jquery ("Div. notempty"). Children (). Each (alertpadding );
}
Protected void alertpadding (){
Window.alert(jquery.this.css ("padding "));
}
}
}
3. Place an axial control on the ASPX page at the front end and set the methodname attribute.
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> jquery test </title>
<SCRIPT type = "text/JavaScript" src = "jquery-1.2.3.min.js"> </SCRIPT>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Div class = "empty" style = "border: 1px solid red;"> </div>
<Div class = "empty" style = "border: 1px solid blue;"> </div>
<Div class = "notempty" style = "border: 1px solid green;">
<Div style = "border: 1px solid purple;"> </div>
</Div>
<Asp: button runat = "server" id = "btnrun" text = "run" onclientclick = "htmlthedivs (); Return false;"/>
<Axial: wfscript runat = "server" id = "wfshtd" methodname = "htmlthedivs"/>
</Form>
</Body>
</Html>
For detailed use of axial, please download the source code from codeplex, which contains detailed code examples.