//******************************************************* // // The BindData method is used to obtain details of a message // from the Discussion table, and update the page with // the message content. // //******************************************************* void BindData() { // Obtain the selected item from the Discussion table ASPNetPortal.DiscussionDB discuss = new ASPNetPortal.DiscussionDB(); IDataReader dr = discuss.GetSingleMessage(itemId); // Load first row from database dr.Read(); // Update labels with message contents Title.Text = (String)dr["title"]; Body.Text = (String)dr["body"]; CreatedByUser.Text = (String)dr["createdbyuser"]; CreatedDate.Text = String.Format("{0:d}", dr["createddate"]); TitleField.Text = ReTitle(Title.Text); int prevId = 0; int nextId = 0; // Update next and preview links object id1 = dr["prevmessageid"]; if (id1 != null && id1 != DBNull.Value) { prevId = (int)id1; prevItem.HRef = Request.Path + "?ItemId=" + prevId + "&mid=" + moduleId; } object id2 = dr["nextmessageid"]; if (id2 != null && id2 != DBNull.Value) { nextId = (int)id2; nextItem.HRef = Request.Path + "?ItemId=" + nextId + "&mid=" + moduleId; } // close the datareader dr.Close(); // Show/Hide Next/Prev Button depending on whether there is a next/prev message if (prevId <= 0) { prevItem.Visible = false; } if (nextId <= 0) { nextItem.Visible = false; } }