📄 advertisementform.aspx.vb
字号:
'文件名:AdvertisementForm.aspx.vb
Imports System.Data.SqlClient
Imports System.Data
Partial Class ContractManage_AdvertisementForm
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim MyForbidString As String = Session("MyForbid").ToString()
If (MyForbidString.IndexOf("D1") > 1) Then
Server.Transfer("~/SystemManage/AllErrorHelp.aspx")
End If
If (Not IsPostBack) Then
Dim MySQLConnectionString As String = ConfigurationManager.ConnectionStrings("MyHouseDBConnectionString").ConnectionString
Dim MyConnection As New SqlConnection(MySQLConnectionString)
Dim MySQL As String = "Select * From 职员信息"
Dim MyPersonnelTable As New DataTable()
Dim MyAdapter As New SqlDataAdapter(MySQL, MyConnection)
MyAdapter.Fill(MyPersonnelTable)
Dim MyName As String = "职员姓名"
Dim MyValue As String = MyPersonnelTable.Rows(0)(MyName).ToString()
For Each MyRow As DataRow In MyPersonnelTable.Rows
Me.DropDownList1.Items.Add(MyRow(MyName).ToString())
Next
If (MyConnection.State = ConnectionState.Open) Then
MyConnection.Close()
End If
End If
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
'新增广告发布信息
Me.SqlDataSource1.Insert()
End Sub
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
'修改广告发布信息
Me.SqlDataSource1.Update()
End Sub
Protected Sub GridView1_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowCreated
'弹出删除操作确认对话框
If (e.Row.RowType = DataControlRowType.DataRow) Then
Dim MyButton As Button = e.Row.FindControl("Button1")
MyButton.OnClientClick = "return confirm('是否确认删除当前选择的记录?')"
End If
End Sub
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
'在控件中显示选择的记录
Me.TextBox4.Text = Me.GridView1.SelectedRow.Cells(2).Text.ToString()
Me.DropDownList1.SelectedValue = Me.GridView1.SelectedRow.Cells(3).Text.ToString()
Me.DropDownList2.SelectedValue = Me.GridView1.SelectedRow.Cells(4).Text.ToString()
Me.TextBox6.Text = Me.GridView1.SelectedRow.Cells(5).Text.ToString()
Me.TextBox7.Text = Me.GridView1.SelectedRow.Cells(6).Text.ToString()
Me.TextBox8.Text = Me.GridView1.SelectedRow.Cells(7).Text.ToString()
Me.TextBox9.Text = Me.GridView1.SelectedRow.Cells(8).Text.ToString()
Me.TextBox10.Text = Me.GridView1.SelectedRow.Cells(9).Text.ToString()
Me.TextBox11.Text = Me.GridView1.SelectedRow.Cells(10).Text.ToString()
Me.TextBox12.Text = Me.GridView1.SelectedRow.Cells(11).Text.ToString()
Me.TextBox13.Text = Me.GridView1.SelectedRow.Cells(12).Text.ToString()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -