colControlCollection = CType(DynamicPlaceHolder.FindControl("DynamicPage"), Entities.Modules.PortalModuleBase).Controls
For Each Item In colControlCollection
tmpType = Item.GetType().FullName
objItemType.RecordID = CInt(CurrentRecord.Text)
objItemType.FormID = CInt(ddlControl.SelectedValue)
Select Case Item.GetType().FullName
Case "System.Web.UI.WebControls.TextBox"
tempTextBox = CType(Item, TextBox)
objItemType.ItemTypeName = "TextBox"
objItemType.ItemName = tempTextBox.ID
objItemType.ItemValue = tempTextBox.Text
If tempTextBox.Rows > 1 Then
objItemType.LargeText = True
End If
Case "System.Web.UI.WebControls.DropDownList"
tempDropDownList = CType(Item, DropDownList)
objItemType.ItemTypeName = "DropDownList"
objItemType.ItemName = tempDropDownList.ID
objItemType.ItemValue = tempDropDownList.SelectedValue
Case "System.Web.UI.WebControls.ListBox"
tempListBox = CType(Item, ListBox)
objItemType.ItemTypeName = "ListBox"
objItemType.ItemName = tempListBox.ID
objItemType.ItemValue = tempListBox.SelectedValue
Case "System.Web.UI.WebControls.CheckBox"
tempCheckBox = CType(Item, CheckBox)
objItemType.ItemTypeName = "CheckBox"
objItemType.ItemName = tempCheckBox.ID
objItemType.ItemValue = tempCheckBox.Checked
Case "System.Web.UI.WebControls.CheckBoxList"
tempCheckBoxList = CType(Item, CheckBoxList)
objItemType.ItemTypeName = "CheckBoxList"
objItemType.ItemName = tempCheckBoxList.ID
Dim strSelectedItem As String = ""
Dim objListItemCollection As ListItemCollection = tempCheckBoxList.Items
Dim objListItem As ListItem
For Each objListItem In objListItemCollection
If objListItem.Selected Then
strSelectedItem += objListItem.Value.Replace(",", "") & ","
End If
Next
If strSelectedItem <> "" Then
strSelectedItem = strSelectedItem.Substring(0, (strSelectedItem.Length - 1))
End If
objItemType.ItemValue = strSelectedItem
Case "System.Web.UI.WebControls.RadioButton"
tempRadioButton = CType(Item, RadioButton)
objItemType.ItemTypeName = "RadioButton"
objItemType.ItemName = tempRadioButton.ID
objItemType.ItemValue = tempRadioButton.Checked
Case "System.Web.UI.WebControls.RadioButtonList"
tempRadioButtonList = CType(Item, RadioButtonList)
objItemType.ItemTypeName = "RadioButtonList"
objItemType.ItemName = tempRadioButtonList.ID
objItemType.ItemValue = tempRadioButtonList.SelectedValue
Case Else
objItemType.RecordID = -1
End Select
' If we have a value then save it
If objItemType.RecordID > 0 Then
DynamicForms_DAL.AddRecordData(objItemType)
DynamicForms_DAL.AddFormData(objItemType)
End If
Next