资源简介
只是一个Aspxgridview用代码实现插入\删除等事件的,是对Devexpress的重新实现,功能是用后台实现的
代码片段和文件信息
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.xml.Linq;
using System.Data.SqlClient;
using DevExpress.Web.ASPxGridView;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender EventArgs e)
{
if (!IsPostBack)
{
//动态的数据库的连接
string Scon = “server=localhost;Initial catalog=MIE;user ID=sa;password=sa;“;
SqlConnection sqlConn = new SqlConnection(Scon);
sqlConn.Open();
SqlCommand Scom = new SqlCommand();
Scom.Connection = sqlConn;
Scom.CommandType = CommandType.Text;
Scom.CommandText = “select * from F_Friendly“;
SqlDataAdapter Sda = new SqlDataAdapter(Scom);
DataSet Myds = new DataSet();
Sda.Fill(Myds “F_Friendly“);
ASPxGridView1.DataSource = Myds;
ASPxGridView1.DataBind();
sqlConn.Close();
//对页面进行动态的添加编辑、删除和更新按扭,也可以在属性中来设置
GridViewCommandColumn xx = new GridViewCommandColumn();
xx.Caption = “编辑“;
xx.NewButton.Visible = true;
xx.DeleteButton.Visible = true;
xx.EditButton.Visible = true;
xx.NewButton.Text = “新建“;
xx.EditButton.Text = “编辑“;
xx.DeleteButton.Text = “删除“;
xx.UpdateButton.Text = “更新“;
xx.CancelButton.Text = “取消“;
xx.VisibleIndex = -1;
ASPxGridView1.Columns.Add(xx);
//加如下面的代码的原因是因为在进行事件操作的时候,Aspxgridview需要一个主键,此处就是在
//页面加载的时候给其动态的添加一个主键
GridViewDataColumn x1 = new GridViewDataColumn();
x1.FieldName = “F_ID“;
x1.VisibleIndex = 1;
x1.Caption = “编号“;
ASPxGridView1.Columns.Add(x1);
x1.Visible = false;
ASPxGridView1.KeyFieldName = “F_ID“;
Session[“chart“] = Myds;//此处是将数据表放入Session中,以便后续事件对表进行调用
}
}
protected void ASPxGridView1_RowDeleting(object sender DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
{
string Scon = “server=localhost;Initial catalog=MIE;user ID=sa;password=sa;“;
SqlConnection sqlConn = new SqlConnection(Scon);
sqlConn.Open();
SqlCommand Scom = new SqlCommand();
Scom.Connection = sqlConn;
Scom.CommandType = CommandType.Text;
Scom.CommandText = “select * from F_Friendly“;
SqlDataAdapter Sda = new SqlDataAdapter(Scom);
DataSet DS = new DataSet();
Sda.Fill(DS “F_Friendly“);
sqlConn.Close();
//用来实现删除操作的e.Keys[0].ToString().Trim() 得到要删除的ID
sqlConn.Open();
Scom.Connection = sqlConn;
Scom.Comm
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1616 2009-07-28 16:24 Aspxgridview示例\Aspxgridview示例.sln
..A..H. 18944 2009-08-12 10:51 Aspxgridview示例\Aspxgridview示例.suo
文件 622592 2008-08-01 12:55 Aspxgridview示例\Bin\DevExpress.Data.v8.2.dll
文件 277934 2008-07-29 12:43 Aspxgridview示例\Bin\DevExpress.Data.v8.2.xm
文件 811008 2008-08-01 12:56 Aspxgridview示例\Bin\DevExpress.Web.ASPxEditors.v8.2.dll
文件 476727 2008-07-29 12:43 Aspxgridview示例\Bin\DevExpress.Web.ASPxEditors.v8.2.xm
文件 615424 2009-07-27 16:17 Aspxgridview示例\Bin\DevExpress.Web.ASPxGridView.v8.2.dll
文件 294 2009-08-03 15:55 Aspxgridview示例\Bin\DevExpress.Web.ASPxGridView.v8.2.dll.refresh
文件 1443328 2009-07-27 16:17 Aspxgridview示例\Bin\DevExpress.Web.ASPxGridView.v8.2.pdb
文件 407158 2008-07-29 12:43 Aspxgridview示例\Bin\DevExpress.Web.ASPxGridView.v8.2.xm
文件 1982464 2008-08-01 12:56 Aspxgridview示例\Bin\DevExpress.Web.v8.2.dll
文件 1214445 2008-07-29 12:43 Aspxgridview示例\Bin\DevExpress.Web.v8.2.xm
文件 596 2009-03-29 08:39 Aspxgridview示例\Bin\jhgl.dal.snk
文件 24576 2009-03-25 09:46 Aspxgridview示例\Bin\Jhgl.DataAccessla
文件 58 2009-08-08 11:16 Aspxgridview示例\Bin\Jhgl.DataAccessla
文件 16384 2009-03-25 09:46 Aspxgridview示例\Bin\Jhgl.Encrypt.dll
文件 42 2009-08-08 11:16 Aspxgridview示例\Bin\Jhgl.Encrypt.dll.refresh
文件 596 2009-03-29 08:39 Aspxgridview示例\Bin\jhgl.encrypt.snk
文件 28672 2009-03-25 09:46 Aspxgridview示例\Bin\Jhgl.Pager.dll
文件 38 2009-08-08 11:16 Aspxgridview示例\Bin\Jhgl.Pager.dll.refresh
文件 596 2009-03-29 08:39 Aspxgridview示例\Bin\jhgl.pager.snk
文件 20480 2009-03-25 09:46 Aspxgridview示例\Bin\Jhgl.Util.dll
文件 36 2009-08-08 11:16 Aspxgridview示例\Bin\Jhgl.Util.dll.refresh
文件 596 2009-03-29 08:27 Aspxgridview示例\Bin\jhgl.util.snk
文件 266752 2009-07-29 10:15 Aspxgridview示例\Bin\SQLServerDAL.dll
文件 42 2009-08-08 11:16 Aspxgridview示例\Bin\SQLServerDAL.dll.refresh
文件 587264 2009-07-29 10:15 Aspxgridview示例\Bin\SQLServerDAL.pdb
文件 4096 2009-08-08 11:24 Aspxgridview示例\ClassLibrary1\bin\Debug\ClassLibrary1.dll
文件 7680 2009-08-08 11:24 Aspxgridview示例\ClassLibrary1\bin\Debug\ClassLibrary1.pdb
文件 24576 2009-03-25 09:46 Aspxgridview示例\ClassLibrary1\bin\Debug\Jhgl.DataAccessla
............此处省略29个文件信息
- 上一篇:Dreamweaver8+ASP动态网站开发
- 下一篇:OCR VB6开发
评论
共有 条评论