werD
06-06-2007, 09:37 PM
hello,
I have a datalist control. Each item has a checkbox and each checkbox has possible options that are shown as a radio button list when the user checks the box. i have a button later in the form for adding a file to the entry which causes a post back. now when this happens i lose my state from the checkboxes and such.
Is there an easy way to keep the posted data from my datalist?
i have done a similar thing on this same page that saves the filenames and ids and such of each file that is added as a string collection(delimeted with ",") to a structure stored as a session variable.
If Session.Item("smsg") Is Nothing Then
smsg.StrFileCol = New StringCollection
smsg.StrFlagCol = New StringCollection
Session.Add("smsg", smsg)
smsg = CType(Session.Item("smsg"), SM_Message)
Else
smsg = CType(Session.Item("smsg"), SM_Message)
'Me.txtTitle.Text = smsg.MessageTitle.ToString
If Not (smsg.StrFlagCol.Count = 0) Then
End If
If Not (smsg.StrFileCol.Count = 0) Then
For i As Integer = 0 To smsg.StrFileCol.Count - 1
Dim item As New ListItem
Dim str() As String = Split(smsg.StrFileCol(i), ",")
'0 location
'1 name
'2 caption
'3 type
'4 id
item.Text = str(1).ToString
item.Value = str(4).ToString
Me.lboxFileUpload.Items.Add(item)
Next
End If
' i initially thought i could handle the flags in a way similar to this
'i should be able to create a string for the flag collection that is "," delimeted with 0 being flag name, 1 checked or not, 2 index of radio thats clicked
'For Each ctrl As Control In Me.dlFlags.Controls
' Dim ckbx As CheckBox
' ckbx = CType(ctrl, CheckBox)
' If Request.Form(ckbx.ID) = "Checked" Then
' ckbx.Checked = True
' End If
'Next
If anyone has ever done a similar method for an order form or survey etc. I would very much appreciate the insight.
Im really not sure how i would do this in a repeated control
Thanks in advance
DrewG
I have a datalist control. Each item has a checkbox and each checkbox has possible options that are shown as a radio button list when the user checks the box. i have a button later in the form for adding a file to the entry which causes a post back. now when this happens i lose my state from the checkboxes and such.
Is there an easy way to keep the posted data from my datalist?
i have done a similar thing on this same page that saves the filenames and ids and such of each file that is added as a string collection(delimeted with ",") to a structure stored as a session variable.
If Session.Item("smsg") Is Nothing Then
smsg.StrFileCol = New StringCollection
smsg.StrFlagCol = New StringCollection
Session.Add("smsg", smsg)
smsg = CType(Session.Item("smsg"), SM_Message)
Else
smsg = CType(Session.Item("smsg"), SM_Message)
'Me.txtTitle.Text = smsg.MessageTitle.ToString
If Not (smsg.StrFlagCol.Count = 0) Then
End If
If Not (smsg.StrFileCol.Count = 0) Then
For i As Integer = 0 To smsg.StrFileCol.Count - 1
Dim item As New ListItem
Dim str() As String = Split(smsg.StrFileCol(i), ",")
'0 location
'1 name
'2 caption
'3 type
'4 id
item.Text = str(1).ToString
item.Value = str(4).ToString
Me.lboxFileUpload.Items.Add(item)
Next
End If
' i initially thought i could handle the flags in a way similar to this
'i should be able to create a string for the flag collection that is "," delimeted with 0 being flag name, 1 checked or not, 2 index of radio thats clicked
'For Each ctrl As Control In Me.dlFlags.Controls
' Dim ckbx As CheckBox
' ckbx = CType(ctrl, CheckBox)
' If Request.Form(ckbx.ID) = "Checked" Then
' ckbx.Checked = True
' End If
'Next
If anyone has ever done a similar method for an order form or survey etc. I would very much appreciate the insight.
Im really not sure how i would do this in a repeated control
Thanks in advance
DrewG