Note: This articleArticleRefer to Lao Zhao's article "user control generation html!
UsingSystem;
UsingSystem. Collections. Generic;
UsingSystem. LINQ;
UsingSystem. Web;
UsingSystem. Web. UI;
UsingSystem. Web. Services;
UsingSystem. IO;
UsingWebfunction;
NamespaceAstarmvc
{
/// <Summary>
///WsajaxAbstract description
/// </Summary>
[WebService(Namespace ="Http://tempuri.org/")]
[Webservicebinding(Conformsto =Wsiprofiles. Basicprofile1_1)]
[System. componentmodel.Toolboxitem(False)]
// To allow ASP. Net ajax to call this web service from a script, cancel the comments to the downstream.
[System. Web. Script. Services.Scriptservice]
Public Class Wsajax: System. Web. Services.WebService
{
[Webmethod(Enablesession =True)]
Public StringGetloginhtml (StringS)
{
Controlmanager<Wcuserlogin> ViewManager =New Controlmanager<Wcuserlogin> ();
VaRControl = ViewManager. loadviewcontrol ("~ /Wcuserlogin. ascx");
ReturnViewManager. renderview (control );
}
[Webmethod(Enablesession =True)]
Public StringGetlogincheck (StringUsername,StringUserpwd,StringCheckcode)
{
Controlmanager<Wcuserlogin> ViewManager =New Controlmanager<Wcuserlogin> ();
VaRControl = ViewManager. loadviewcontrol ("~ /Wcuserlogin. ascx");
Control. Username = username;
Control. userpwd = userpwd;
Control. checkcode = checkcode;
StringMSG = control. userlogin () ="1"?"Loginsucess":"Loginerror";
// String jsondata = "{ucresult:" "+ ViewManager. renderview (Control) +", msgresult: "+ MSG + """}";
Return "<! --"+ MSG +"-->"+ ViewManager. renderview (control );
}
[Webmethod(Enablesession =True)]
Public StringExitlogin (StringA)
{
Controlmanager<Wcuserlogin> ViewManager =New Controlmanager<Wcuserlogin> ();
VaRControl = ViewManager. loadviewcontrol ("~ /Wcuserlogin. ascx");
Control. exitlogin ();
ReturnViewManager. renderview (control );
}
[Webmethod]
Public StringGetpagingdata (IntPage)
{
Controlmanager<Pagingdata> ViewManager =New Controlmanager<Pagingdata> ();
VaRControl = ViewManager. loadviewcontrol ("~ /Pagingdata. ascx");
Control. pageindex = page;
ReturnViewManager. renderview (control );
}
}
}