Ajax applications in. net

Source: Internet
Author: User
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 >

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.