JQueryEasyUI does not need to be introduced. It is a lightweight UI framework, and now there are many resources in this regard, but there are few real instances, especially. net, but Sun Yu has been releasing some EasyUI videos, which may be of great help to everyone. How about me, you can only use one instance to introduce how to use EasyUI.
JQueryEasyUI does not need to be introduced. It is a lightweight UI framework, and now there are many resources in this regard, but there are few real instances, especially. net, but Sun Yu has been releasing some EasyUI videos, which may be of great help to everyone. How about me, we only use one instance to introduce the EasyUI (You are actually a little white, hey ).
With the help of the crazy talent interface framework, everyone feels pretty good.
We all know the drawbacks of. Net Server-side controls. Therefore, we completely discard server-side controls and use all client-side controls.
Below are some preparations.
The following documents and materials will be uploaded later for you to download!
Jquery-easyui-1.2.6 is used here
The jQuery and jQuery EasyUI versions in Xiucai are relatively low, and you can modify them as needed.
Here I will only describe the added parts:
Logon window
ViewCode
User name:
Password:
Initialize JS in the login window
ViewCode
Var formLogin = $ ('# formLogin ');
If (getCookie ('username') = null) // logon to Dialog is displayed if you are not logged on. Otherwise, the rendering is not performed.
FormLogin. dialog ({modal: true,
Closable: false,
Buttons :[{
Text: 'login', handler: function (){
If (! FormLogin. form ("validate ")){
Return;
}
$. Post (
'/Ajax/HandlerLogin. ashx ',
{"Username": $ ("# ipt_username"). val (), "userpwd": $ ("# ipt_userpwd"). val ()},
Function (){
If (a = '0') {// login successful
$. Messager. alert ('hprompt ', 'logon successful', 'info ')
SetCookie ('username', 'wikstone ');
FormLogin. dialog ('close ');
}
Else {// Logon Failed
$. Messager. alert ('hprompt ', 'logon failed', 'info ')
}
}
);
}
}]
}
);
AJAX HandlerLogin Page code
ViewCode
Public void ProcessRequest (HttpContext context)
{
Context. Response. ContentType = "text/plain ";
UserName = context. Request. Form ["username"]. ToString ();
UserPwd = context. Request. Form ["userpwd"]. ToString ();
Context. Response. Write (CheckLogin (userName, userPwd ));
}
Private string CheckLogin (string uname, string upwd)
{
BLL. TUser bll = new BLL. TUser ();
DataTable dt = bll. GetList ("UserName = '" + uname + "' and UserPwd = '" + upwd + "'"). Tables [];
If (dt. Rows. Count>)
{
Return ""; // logon successful
}
Else
Return "";
}
Unlogged on page
After Logon:
Main functions: as a simple example, only user management modules are available: List, add, modify, and delete.
List:
Added:
Modify:
Delete:
Source code download
Http://upload.server110.com/file/20140404/1-140404102S3595.zip