asp.net c# 服务器端各绑定控件常用
asp.net有时候常常用服务器绑定控件有些麻烦...
代码有些杂....
using System;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Web;
using System.Text;
namespace pub.mo
{
public class bind
{
private bind() { }
#region Bind Repeater
public static void repeater(string sql, Repeater dl)
{
using (IDataReader dr = dbhelp.read(sql))
{
repeater(dr, dl);
}
}
/// <summary>
/// 分页绑定
/// </summary>
/// <param name="fd">dd</param>
/// <param name="um"></param>
/// <param name="dl"></param>
/// <returns></returns>
public static fy repeater(fy_date fd, url_manager um, Repeater dl)
{
fy f = new fy(fd, um);
f.suger_page_load();
repeater(f.fd.records, dl);
return f;
}
public static void repeater(IDataReader dr, Repeater dl)
{
dl.DataSource = dr;
dl.DataBind();
dr.Close();
}
public static void repeater(DataTable dt, Repeater dl)
{
if (dt != null)
{
dl.DataSource = dt;
dl.DataBind();
dt.Clear();
dt.Dispose();
}
}
public static void repeater(DataTable dt, Repeater dl, bool pB)
{
if (dt != null)
{
dl.DataSource = dt;
dl.DataBind();
if (pB)
{
dt.Clear();
dt.Dispose();
}
}
}
public static void repeater(DataRow[] drw, Repeater dl)
{
if (drw != null)
{
相关文档:
在你的Page_Load中添加这样的代码:
Page.Response.Clear();
bool success = ResponseFile(Page.Request, Page.Response, "目的文件名称", @"源文件路径", 1024000);
if (!success)
Response.Write("下载文件出错!");
Page.Response.End();
文件下载函数代码为:
public static bo ......
如果你已经有较多的面向对象开发经验,跳过以下这两步:
第一步 掌握一门.NET面向对象语言,C#或VB.NET。
我强烈反对在没系统学过一门面向对象语言的前提下去学ASP.NET。
ASP.NET是一个全面向对象的技术,不懂面向对象,那绝对学不下去!
第二步 对.NET Framework类库有一定的了解
可以通过开发Windows Form应用 ......
其实所谓的伪静态页面,就是指的URL重写,在ASP.NET中实现非常简单
首先你要在你的项目里引用两个DLL:
ActionlessForm.dll
UR ......
using System;
using System.Web;
namespace pub.mo
{
public class js
{
private js() { }
private static string scr_j1 = "<mce:script type=\"text/javascript\"><!--
";
private static string scr_j2 = "
// --></mce:script>";
/// <summa ......