Public Class mymanage
Inherits System.Web.UI.Page
#Region " Web 窗体设计器生成的代码 "
'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid
Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm
'注意: 以下占位符声明是 Web 窗体设计器所必需的。
'不要删除或移动它。
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
bindgrid()
End If
End Sub
Sub bindgrid()
'DataGrid1.DataSource = mydb.gettable("select * from articles where art_col_sub=" & Request.QueryString("art_col_sub"))
DataGrid1.DataSource = mydb.gettable(CType(Request.QueryString("art_col_sub"), Integer))
DataGrid1.DataKeyField = "id"
DataGrid1.DataBind()
End Sub
Private Sub DataGrid1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGrid1.SelectedIndexChanged
End Sub
Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.ItemCommand
Select Case e.CommandName
Case "Delete"
' Response.Write(DataGrid1.DataKeys(e.Item.ItemIndex))
mydb.delrecord(DataGrid1.DataKeys(e.Item.ItemIndex))
Case "disp"
Response.Redirect(String.Format("disp.aspx?art_col_sub={0}", DataGrid1.DataKeys(e.Item.ItemIndex)))
bindgrid()
End Select
End Sub
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
If Len(e.Item.Cells(5).Text) > 12 Then
e.Item.Cells(5).Text = Mid(e.Item.Cells(5).Text, 1, 12) + "......"
End If
' Dim btnDelete As ImageButton
'btnDelete = CType(e.Item.FindControl("btnDelete"), ImageButton)
'btnDelete.Attributes.Add("onclick", "return confirm('Warning: This will delete ALL records, including all content pages and users, associated with this community.')")
End If
End Sub
End Class