I'm a newbie using VWD 2008 Express edition. I am trying to insert code on each aspx page to read a record from a table within my database, and update the page title and meta tags on my webpage.
Right now I use a datalist control to access the data and use the following code.
Protected Sub DataList2_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs)
Dim recordcontent As String
If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
RecordContent = CType(DataBinder.Eval(e.Item.DataItem, "title"), String) & vbCrLf
Page.Title = RecordContent
End If
End Sub
This works. But I think a cleaner way would be to open the database and read the record in the page load event and change the title there. Or even to have some global code somewhere that when called will return to me the title and metatags that were read. Are there any good tutorials out there that would point to me how to do this, or can someone just step me through it.
Thanks!