温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:Asp.net房产中介管理系统源码及常用文档
当前文件路径:HouseManage/ContractManage/AdvertisementForm.aspx.cs

1//文件名:AdvertisementForm.aspx.cs 2
using System; 3
using System.Data; 4
using System.Configuration; 5
using System.Collections; 6
using System.Web; 7
using System.Web.Security; 8
using System.Web.UI; 9
using System.Web.UI.WebControls; 10
using System.Web.UI.WebControls.WebParts; 11
using System.Web.UI.HtmlControls; 12
13
using System.Data.SqlClient; 14
public partial class ContractManage_AdvertisementForm : System.Web.UI.Page 15
{ 16
protected void Page_Load(object sender, EventArgs e) 17
{ 18
string MyForbidString = Session["MyForbid"].ToString(); 19
if (MyForbidString.IndexOf("D1") > 1) 20
{ 21
Server.Transfer("~/SystemManage/AllErrorHelp.aspx"); 22
} 23
if (!IsPostBack) 24
{ 25
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyHouseDBConnectionString"].ConnectionString; 26
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString); 27
string MySQL = "Select * From 职员信息"; 28
DataTable MyPersonnelTable = new DataTable(); 29
SqlDataAdapter MyAdapter = new SqlDataAdapter(MySQL, MyConnection); 30
MyAdapter.Fill(MyPersonnelTable); 31
string MyName = "职员姓名"; 32
string MyValue = MyPersonnelTable.Rows[0][MyName].ToString(); 33
foreach (DataRow MyRow in MyPersonnelTable.Rows) 34
{ 35
this.DropDownList1.Items.Add(MyRow[MyName].ToString()); 36
} 37
if (MyConnection.State == ConnectionState.Open) 38
{ 39
MyConnection.Close(); 40
} 41
} 42
} 43
protected void Button2_Click(object sender, EventArgs e) 44
{//新增广告发布信息 45
this.SqlDataSource1.Insert(); 46
} 47
protected void Button3_Click(object sender, EventArgs e) 48
{//修改广告发布信息 49
this.SqlDataSource1.Update(); 50
} 51
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) 52
{//弹出删除操作确认对话框 53
if (e.Row.RowType == DataControlRowType.DataRow) 54
{ 55
Button MyButton = (Button)e.Row.FindControl("Button1"); 56
MyButton.OnClientClick = "return confirm('是否确认删除当前选择的记录?')"; 57
} 58
} 59
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) 60
{//在控件中显示选择的记录 61
this.TextBox4.Text = this.GridView1.SelectedRow.Cells[2].Text.ToString(); 62
this.DropDownList1.SelectedValue = this.GridView1.SelectedRow.Cells[3].Text.ToString(); 63
this.DropDownList2.SelectedValue = this.GridView1.SelectedRow.Cells[4].Text.ToString(); 64
this.TextBox6.Text = this.GridView1.SelectedRow.Cells[5].Text.ToString(); 65
this.TextBox7.Text = this.GridView1.SelectedRow.Cells[6].Text.ToString(); 66
this.TextBox8.Text = this.GridView1.SelectedRow.Cells[7].Text.ToString(); 67
this.TextBox9.Text = this.GridView1.SelectedRow.Cells[8].Text.ToString(); 68
this.TextBox10.Text = this.GridView1.SelectedRow.Cells[9].Text.ToString(); 69
this.TextBox11.Text = this.GridView1.SelectedRow.Cells[10].Text.ToString(); 70
this.TextBox12.Text = this.GridView1.SelectedRow.Cells[11].Text.ToString(); 71
this.TextBox13.Text = this.GridView1.SelectedRow.Cells[12].Text.ToString(); 72
} 73
} 74





}
}