易截截图软件、单文件、免安装、纯绿色、仅160KB

Asp.net 中GridView各种用法

1.GridView无代码分页排序:
效果图:
1.AllowSorting设为True,aspx代码中是AllowSorting="True";
2.默认1页10条,如果要修改每页条数,修改PageSize即可,在aspx代码中是PageSize="12"。
3.默认的是单向排序的,右击GridView弹出“属性”,选择AllowSorting为True即可。
2.GridView选中,编辑,取消,删除:
效果图:
后台代码:
你可以使用sqlhelper,本文没用。代码如下:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
//清清月儿http://blog.csdn.net/21aspnet
    SqlConnection sqlcon;
    SqlCommand sqlcom;
    string strCon = "Data Source=(local);Database=数据库名;Uid=帐号;Pwd=密码";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            bind();
        }
    }
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        GridView1.EditIndex = e.NewEditIndex;
        bind();
    }
//删除
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string sqlstr = "delete from 表 where id='" + GridView1.DataKeys[e.RowIndex].Value.ToString() + "'";
        sqlcon = new SqlConnection(strCon);
        sqlcom = new SqlCommand(sqlstr,sqlcon);
    


相关文档:

Asp.Net 分层开发

数据层: Linq to sql
业务逻辑层:自己实现,封装业务对象对数据库的访问,我的逻辑层比你的做的工作要多,我减少了UI层的代码量。
Model层:用于UI层展示使用的Model,数据可能来源于多张表,具体数据填充在逻辑层中负责
UI层:负责传递数据,展示数据
SQL的质量其实和程序员的水平有关
这也是为什么微软一直努力让大 ......

ASP.NET(C#)常用代码30例

1. 打开新的窗口并传送参数:
  传送参数:
response.write("<script>window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)</script>")
  接收参数:
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
  2.为按钮添加对话框
Button1 ......

ASP.NET 2.0中OWC生成柱状图和饼状图

1、首先下载owc11:owc11(http://www.svnhost.cn/Download/Detail-60.shtml)
2、引用OWC:打开"解决方案资源管理器"面板,鼠标右键单击"引用",选择"添加引用"菜单,在弹出的"添加引用"对话框中单击"COM"卡片,找到"Microsoft Office Web Components 10.0(office 2003是11.0)",单击"选择"和"确定"按钮,OWC就被添加到了引 ......

[Asp.Net]数据库连接字符串大全(转)

SQL服务器 ODBC连接方式
标准安全连接
Driver={SQL Server};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
信任连接
Driver={SQL Server};Server=myServerAddress;Database=myDataBase;Trusted_Connection=Yes;
提示输入用户名和密码方式
这个有一点问题,首先你需要设置一个Pro ......

ASP.NET调用存储过程

        public static string GetCustomerCName(ref ArrayList arrayCName,ref ArrayList arrayID)
        {
            SqlConnection con=ADConnection.createConnection();
  ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号