Admin_UserXianxi.aspx.cs
资源名称:SunShine.rar [点击查看]
上传用户:tjxpgg
上传日期:2017-05-14
资源大小:2244k
文件大小:2k
源码类别:
SilverLight
开发平台:
ASP/ASPX
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- 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;
- public partial class Admin_UserXianxi : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- ViewState["id"] =Convert.ToInt32(Request.QueryString["id"]);
- Bind();
- }
- }
- public void Bind()
- {
- this.DetailsView1.DataSource = DBHelp.Select("select * from users where id=" + Convert.ToInt32(ViewState["id"]) + "");
- this.DetailsView1.DataBind();
- }
- protected void DetailsView1_ModeChanging(object sender, DetailsViewModeEventArgs e)
- {
- this.DetailsView1.ChangeMode(e.NewMode);
- Bind();
- }
- protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
- {
- string loginname = (this.DetailsView1.Rows[0].Cells[1].Controls[0] as TextBox).Text;
- string loginPwd = (this.DetailsView1.Rows[1].Cells[1].Controls[0] as TextBox).Text;
- string name = (this.DetailsView1.Rows[2].Cells[1].Controls[0] as TextBox).Text;
- string address = (this.DetailsView1.Rows[3].Cells[1].Controls[0] as TextBox).Text;
- string phone = (this.DetailsView1.Rows[4].Cells[1].Controls[0] as TextBox).Text;
- string id = (this.DetailsView1.Rows[5].Cells[1].Controls[0] as TextBox).Text;
- string mail = (this.DetailsView1.Rows[6].Cells[1].Controls[0] as TextBox).Text;
- if (DBHelp.Update("update users set loginid='" + loginname + "',loginpwd='" + loginPwd + "',name='" + name + "',address='" + address + "',phone='" + phone + "',mail='" + mail + "' where id=" + Convert.ToInt32(ViewState["id"]) + ""))
- {
- this.DetailsView1.ChangeMode(DetailsViewMode.ReadOnly);
- Bind();
- }
- else
- {
- Response.Write("更新失败,原因未知!╮(╯_╰)╭");
- }
- }
- }