资源简介
一个简单的ajax与后端交互的例子,可以尝试着自己去改写了,以后有更好的资源我就继续上传的

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
using System.Data;
using System.Reflection;
using System.Collections;
using System.Data.Common;
namespace AjaxTest01.Common
{
//Json转化类
public class ConvertToJson
{
#region 私有方法
private static string StringToJson(string s)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.Length;i++ )
{
char c=s.ToCharArray()[i];
switch(c)
{
case ‘\“‘:
sb.Append(“\\\““);
break;
case ‘\\‘:
sb.Append(“\\\\“);
break;
case ‘/‘:
sb.Append(“\\/“);
break;
case ‘\b‘:
sb.Append(“\\b“);
break;
case ‘\f‘:
sb.Append(“\\f“);
break;
case‘\n‘:
sb.Append(“\\n“);
break;
case ‘\r‘:
sb.Append(“\\r“);
break;
case ‘\t‘:
sb.Append(“\\t“);
break;
default:
sb.Append(c);
break;
}
}
return sb.ToString();
}
///
/// 格式化字符型、日期型、布尔型
///
///
///
///
private static string StringFormat(string strType type)
{
if(type==typeof(string))
{
str = StringToJson(str);
str = “\““ + str + “\““;
}
else if(type==typeof(DateTime))
{
str = “\““ + str + “\““;
}
else if(type==typeof(bool))
{
str = str.ToLower();
}
else if(type!=typeof(string)&&string.IsNullOrEmpty(str))
{
str = “\““ + str + “\““;
}
return str;
}
#endregion
#region List转化成Json
public static string ListToJson(IList list)
{
object obj = list[0];
return ListToJson(list obj.GetType().Name);
}
private static string ListToJson(IList list string JsonName)
{
StringBuilder Json = new StringBuilder();
if (string.IsNullOrEmpty(JsonName)) JsonName = list[0].GetType().Name;
Json.Append(“{\““+JsonName+“\“:[“);
if(list.Count>0)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-03-11 20:23 AjaxTest01\
目录 0 2018-03-11 20:24 AjaxTest01\.vs\
目录 0 2018-03-11 20:23 AjaxTest01\.vs\AjaxTest01\
目录 0 2018-03-11 20:23 AjaxTest01\.vs\AjaxTest01\v14\
文件 59904 2018-03-11 20:59 AjaxTest01\.vs\AjaxTest01\v14\.suo
目录 0 2018-03-11 20:24 AjaxTest01\.vs\config\
文件 86073 2018-03-11 20:24 AjaxTest01\.vs\config\applicationhost.config
目录 0 2018-03-11 20:59 AjaxTest01\AjaxTest01\
文件 5465 2018-03-11 15:26 AjaxTest01\AjaxTest01\AjaxTest01.csproj
文件 1086 2018-03-11 15:26 AjaxTest01\AjaxTest01\AjaxTest01.csproj.user
目录 0 2018-03-11 17:33 AjaxTest01\AjaxTest01\Common\
文件 10695 2018-03-11 17:33 AjaxTest01\AjaxTest01\Common\ConvertToJson.cs
文件 12334 2018-03-11 15:26 AjaxTest01\AjaxTest01\Common\DbHelper.cs
目录 0 2018-03-11 14:05 AjaxTest01\AjaxTest01\Css\
文件 3317 2018-03-11 14:04 AjaxTest01\AjaxTest01\Css\cy.css
文件 60 2018-03-11 14:05 AjaxTest01\AjaxTest01\Css\st
目录 0 2018-03-11 20:59 AjaxTest01\AjaxTest01\Images\
文件 1310 2018-03-11 20:58 AjaxTest01\AjaxTest01\Index.html
目录 0 2018-03-11 12:32 AjaxTest01\AjaxTest01\Js\
文件 95957 2018-03-11 12:31 AjaxTest01\AjaxTest01\Js\jquery-1.11.3.min.js
文件 273199 2018-03-11 12:32 AjaxTest01\AjaxTest01\Js\jquery.js
文件 93100 2018-03-11 12:32 AjaxTest01\AjaxTest01\Js\jquery.min.js
目录 0 2018-03-11 20:33 AjaxTest01\AjaxTest01\Manager\
文件 96 2018-03-11 12:21 AjaxTest01\AjaxTest01\Manager\Index.ashx
文件 1099 2018-03-11 20:33 AjaxTest01\AjaxTest01\Manager\Index.ashx.cs
目录 0 2018-03-11 12:10 AjaxTest01\AjaxTest01\Properties\
文件 1322 2018-03-11 12:10 AjaxTest01\AjaxTest01\Properties\AssemblyInfo.cs
文件 1245 2018-03-11 12:10 AjaxTest01\AjaxTest01\Web.Debug.config
文件 1306 2018-03-11 12:10 AjaxTest01\AjaxTest01\Web.Release.config
文件 560 2018-03-11 20:59 AjaxTest01\AjaxTest01\Web.config
目录 0 2018-03-11 12:54 AjaxTest01\AjaxTest01\bin\
............此处省略16个文件信息
- 上一篇:秋亿网络文件管理
- 下一篇:Spring+3.x企业应用开发实战光盘源码(全)
相关资源
- 上传下达任务管理平台(asp源码+acc
- VB版免杀远程控制服务端及客户端源码
- 简单的asp课程网站
- 阿里云短信接口Demo_For Asp
- 酒店管理系统(ASP.NET)
- 经典ASP企业网站管理系统后台模板
- asp.net文档管理系统
- WEB在线考试系统商业无限制ASP源代码
- asp图书馆管理系统
- 教材管理系统Asp.net
- 基于asp的仓库管理系统
- ASP四级联动下拉框代码
- ASP 个人博客网站
- 在线投票(asp)
- 一个完整的IT资产管理系统,ASP
- Office 2007 六组件 转PDF 加载项 SaveAsP
- aspx 购物车详细源码
- Excel导入ACCESS数据库(ASP无组件上传,
- asp.net使用 百度 Ueditor 完整实例,可以
- Mysql asp.net 数据库管理源代码
- asp酒店管理系统源代码
- 聊天室系统 课程设计 asp.net
- 网上教学系统 asp.net
- ASP.NET员工绩效考核系统
- asp.net sqlserver单选题考试系统
- 小学生四则运算试题产生系统(asp.
- asp.net 2.0 sql sever 2000 购物车网站
- 图书馆管理系统(ASP.NET)附带数据库
- 超简易asp仓管系统
- 在线考试系统完整代码 ASP
评论
共有 条评论