Configure webconfig first, as shown below: 1 < Configuration >
2 < Appsettings >
3 < Add Key = "Connectionstring" Value = "Workstation id = (local); packet size = 4096; user id = sa; Data Source = (local); persist Security info = true; initial catalog = ckgl; password = sa" />
4 </ Appsettings >
5 < System . Web >
6 < Httphandlers >
7 < Add Verb = "Post, get" Path = "Ajaxpro/*. ashx" Type = "Ajaxpro. ajaxhandlerfactory, ajaxpro" />
8 </ Httphandlers >
9 .
10 .
11 .
12 </ System. Web >
13 </ Configuration >
14
Add the following content in global. asax. 1 Protected Void Application_start (Object sender, eventargs E)
2 {< br> 3 ajaxpro. utility. handlerpath = " ajaxpro " ;
4 }
HowCodeThe key is to add the following code in the background code page_load:Private VoidPage_load (ObjectSender, system. eventargs E)
{
Ajaxpro. Utility. registertypeforajax (Typeof(Func. getmaxid ));
}
The following is a simple example:
Background code1 [Ajaxpro. ajaxmethod]
2 Public String Get_lsbm ( String Dlbm, String Xlbm)
3 {
4 String Strsql = @" Select STR (max (cast (lsbm as INT) + 1) from jb_lsbm where dlbm =' " + Dlbm. Trim () + " 'And xlbm =' " + Xlbm. Trim () + " ' " ;
5 Func. data_operation dop1 = New Func. data_operation ();
6 String Strid = Dop1.execommmax (strsql );
7 If (Strid = Null )
8 Strid = " 1 " ;
9 Return Func. data_operation.stringformat (Strid. Trim (), 7 ). Trim ();
10 }
Foreground script < Script >
Function Wopen (form)
{
VaRXlbm=Func. getmaxid. get_lsbm (STR [1], STR [3]). Value;
Form. _ lsbm. Value=Xlbm;
}
</ Script >