温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:唐唐企业管理网站源码
当前文件:
TangCompany/Manager/EditerMessage.aspx.cs,打开代码结构图
TangCompany/Manager/EditerMessage.aspx.cs,打开代码结构图1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
using System.Data.SqlClient; 12
13
public partial class Manager_EditerMessage : System.Web.UI.Page 14
{ 15
protected void Page_Load(object sender, EventArgs e) 16
{ 17
18
} 19
protected void BindMessage() { 20
21
string nId = string.Empty; 22
if(Request.QueryString["Id"]!=null){ 23
24
nId = Request.QueryString["Id"].ToString(); 25
26
} 27
SqlParameter[] paras ={ new SqlParameter("Id", SqlDbType.Int, 4) }; 28
paras[0].Value = nId; 29
FormViewMessage.DataSource = SqlHelper.ExcuteReadApdater("sys_ByIdSelectMessage", CommandType.StoredProcedure, paras); 30
FormViewMessage.DataBind(); 31
32
} 33
protected string IsSex(string isBool) { 34
35
string txtSex = string.Empty; 36
if (isBool.ToLower() == "true") 37
{ 38
39
txtSex = "男孩"; 40
41
} 42
else { 43
44
txtSex = "女孩"; 45
46
} 47
return txtSex; 48
49
} 50
protected string IsBool(string isBool) { 51
52
string txtBool = string.Empty; 53
if (isBool.ToLower() == "true") 54
{ 55
56
txtBool = "1"; 57
58
} 59
else { 60
61
txtBool = "0"; 62
63
} 64
return txtBool; 65
66
} 67
protected void ButtonUpdate_Click(object sender, EventArgs e) 68
{ 69
string nId = Request.QueryString["Id"].ToString(); 70
string txtName = ((TextBox)FormViewMessage.FindControl("TextBoxName")).Text; 71
string txtSex = ((TextBox)FormViewMessage.FindControl("TextBoxSex")).Text; 72
string txtEmxil = ((TextBox)FormViewMessage.FindControl("TextBoxEmail")).Text; 73
string txtQQ = ((TextBox)FormViewMessage.FindControl("TextBoxQQ")).Text; 74
string txtHiden = ((DropDownList)FormViewMessage.FindControl("TextBoxHidden")).SelectedValue; 75
string txtSelect = ((DropDownList)FormViewMessage.FindControl("SelectVis")).SelectedValue; 76
string txtHomePage = ((TextBox)FormViewMessage.FindControl("TextBoxHomePage")).Text; 77
string txtContent = ((TextBox)FormViewMessage.FindControl("TextBoxContent")).Text; 78
SqlParameter[] paras ={ new SqlParameter("Id",SqlDbType.Int,4), 79
new SqlParameter("@Name",SqlDbType.NVarChar,30), 80
new SqlParameter("@Sex",SqlDbType.Bit), 81
new SqlParameter("@Email",SqlDbType.NVarChar,50), 82
new SqlParameter("@QQ",SqlDbType.BigInt,8), 83
new SqlParameter("@HomePage",SqlDbType.NVarChar,50), 84
new SqlParameter("@Content",SqlDbType.NVarChar,200), 85
new SqlParameter("@Types",SqlDbType.Bit), 86
new SqlParameter("@Vis",SqlDbType.Bit), 87
88
}; 89
paras[0].Value = nId; 90
paras[1].Value = txtName; 91
paras[2].Value = txtSex; 92
paras[3].Value = txtEmxil; 93
paras[4].Value = txtQQ; 94
paras[5].Value = txtHiden; 95
paras[6].Value = txtSelect; 96
paras[7].Value = txtHomePage; 97
paras[8].Value = txtContent; 98
99
SqlHelper.ExcuteNonQurey("UPDATE [Message] SET Name=@Name,Sex=@Sex,Email=@Email,QQ=@QQ,HomePage=@HomePage,Content=@Content,Types=@Types,Vis=@Vis WHERE Id=@Id", CommandType.Text, paras); 100
BindMessage(); 101
Response.Redirect("Message.aspx"); 102
} 103
} 104





}
}