A
Andy B.
I have the following code inside of a DataList.Item_Created event (in a
web user control):
If (e.Item.ItemType = ListItemType.Header) Then
Dim TitleTextBox As TextBox =
DirectCast(e.Item.FindControl("TitleTextBox"), TextBox)
Dim DescriptionTextBox As TextBox =
DirectCast(e.Item.FindControl("DescriptionTextBox"), TextBox)
Dim BodyTextBox As TextBox =
DirectCast(e.Item.FindControl("BodyTextBox"), TextBox)
'*** Save in session for use on next page
Session("NewsTitle") = TitleTextBox.Text
Session("NewsBody") = BodyTextBox.Text
Session("NewsDescription") = DescriptionTextBox.Text
Session("NewsCreationDate") = Date.Now
End If
I then have a button click event that has this in it:
Server.Transfer("file.aspx")
My problem is when I do this on the next page, I only get the date
created above. This is what I do in the target page:
Dim Title As String = DirectCast(Session("NewsTitle"), String)
Dim Description As String = DirectCast(Session("NewsDescription"), String)
Dim Body As String = DirectCast(Session("NewsBody"), String)
Dim CreationDate As Date = DirectCast(Session("NewsCreationDate"), Date)
Response.Write(Title)
Response.Write(Description)
Response.Write(Body)
Response.Write(CreationDate.ToString("f"))
Any idea what could be going wrong and how I can fix it?
web user control):
If (e.Item.ItemType = ListItemType.Header) Then
Dim TitleTextBox As TextBox =
DirectCast(e.Item.FindControl("TitleTextBox"), TextBox)
Dim DescriptionTextBox As TextBox =
DirectCast(e.Item.FindControl("DescriptionTextBox"), TextBox)
Dim BodyTextBox As TextBox =
DirectCast(e.Item.FindControl("BodyTextBox"), TextBox)
'*** Save in session for use on next page
Session("NewsTitle") = TitleTextBox.Text
Session("NewsBody") = BodyTextBox.Text
Session("NewsDescription") = DescriptionTextBox.Text
Session("NewsCreationDate") = Date.Now
End If
I then have a button click event that has this in it:
Server.Transfer("file.aspx")
My problem is when I do this on the next page, I only get the date
created above. This is what I do in the target page:
Dim Title As String = DirectCast(Session("NewsTitle"), String)
Dim Description As String = DirectCast(Session("NewsDescription"), String)
Dim Body As String = DirectCast(Session("NewsBody"), String)
Dim CreationDate As Date = DirectCast(Session("NewsCreationDate"), Date)
Response.Write(Title)
Response.Write(Description)
Response.Write(Body)
Response.Write(CreationDate.ToString("f"))
Any idea what could be going wrong and how I can fix it?