温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:达达ASP.NET企业信息管理系统
当前文件路径:DaDaEnterprise/Admin/Admin_EditView.aspx.cs

1using System; 2
using System.Collections; 3
using System.Configuration; 4
using System.Data; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.HtmlControls; 9
using System.Web.UI.WebControls; 10
using System.Web.UI.WebControls.WebParts; 11
12
public partial class Admin_Admin_EditView : System.Web.UI.Page 13
{ 14
protected void Page_Load(object sender, EventArgs e) 15
{ 16
string sql = "select * from [View] where id=" + Request.QueryString["id"]; 17
DataTable Dt = DataAccess.GetDataTable(sql); 18
if (!IsPostBack) 19
{ 20
DroDownList(); 21
TextBox1.Text = Dt.Rows[0]["Name"].ToString(); 22
TextBox2.Text = Dt.Rows[0]["ComeFrom"].ToString(); 23
Content.Value = Dt.Rows[0]["ViewCont"].ToString(); 24
DropDownList1.SelectedValue = Dt.Rows[0]["ClsId"].ToString(); 25
} 26
} 27
28
public void DroDownList() 29
{ 30
string sql = "select * from [Class]"; 31
DropDownList1.DataSource = DataAccess.GetDataSet(sql); 32
DropDownList1.DataTextField = "ClsName"; 33
DropDownList1.DataValueField = "id"; 34
DropDownList1.DataBind(); 35
} 36
37
protected void Sub_Click(object sender, EventArgs e) 38
{ 39
string sql = "update [View] set Name='" 40
+ TextBox1.Text + "',ComeFrom='" 41
+ TextBox2.Text + "',ViewCont='" 42
+ Content.Value + "',ClsName='" 43
+ DropDownList1.SelectedItem.Text + "',ClsId='" 44
+ DropDownList1.SelectedItem.Value + "' where id=" + Request.QueryString["id"]; 45
if (DataAccess.ExecuteCmd(sql) > 0) 46
{ 47
Response.Redirect("./Admin_View.aspx"); 48
} 49
else Response.Write("<scripr>alert('编辑失败');</script>"); 50
} 51
} 52





}
}