Partial Class Comment
Inherits System.Web.UI.Page
Dim selectData As New selectDB
Dim insertData As New insertToDB
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
HiddenField1.Value = selectData.ForumDetails(Session("ForumID")).Tables(0).Rows(0).Item("forumid")
lblTitle.Text = selectData.ForumDetails(Session("ForumID")).Tables(0).Rows(0).Item("Title")
lblDescription.Text = selectData.ForumDetails(Session("ForumID")).Tables(0).Rows(0).Item("Description")
lblPostedName.Text = selectData.ForumDetails(Session("ForumID")).Tables(0).Rows(0).Item("PostedName")
End If
Dim runID As Integer
runID = insertData.runID("Reply", "CommentID")
HiddenField2.Value = runID
End Sub
Protected Sub cmdSend_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdSend.Click
insertData.Reply(HiddenField2.Value, txtCommentBy.Text, txtComment.Text, HiddenField1.Value)
Response.Redirect("comment.aspx")
Dim i As Integer
Dim num As Integer
i = 1
num = selectData.Reply(HiddenField1.Value).Tables("reply").Rows.Count
If Page.IsPostBack Then
While i <= num
lblCommentID.Text = selectData.Reply(HiddenField1.Value).Tables(0).Rows(i).Item("commentid")
lblDescription2.Text = selectData.Reply(HiddenField1.Value).Tables(0).Rows(i).Item("description")
lblCommentedName.Text = selectData.Reply(HiddenField1.Value).Tables(0).Rows(i).Item("CommentedName")
End While
End If
End Sub
Protected Sub cmdCancle_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdCancle.Click
Response.Redirect("showForum.aspx")
End Sub
End Class
Tag : .NET, Ms SQL Server 2005, Web (ASP.NET), VB.NET