I have a button, that when clicked is supposed to update a few textboxes on a form, and then loop through all controls on the form to build a string. I know that the textboxes are being updated, but when I loop through the controls, the old values are being returns. Below is a section of code that shows how I am updating the textboxes, and then looping through the form. Please let me know if you know what's wrong here, or if you need more information. Thanks!
Sub find_record(sender As Object, e As EventArgs)
Dim returnString As String
Dim ctr as Control
Dim frm as Control
Dim myLabel as Label
Dim myDDList as DropDownList
frm = FindControl("_ctl0")
For Each ctr in frm.Controls
If Not(ctr.ID = "" OR ctr.GetType().toString() = "System.Web.UI.WebControls.Button") Then
If ctr.GetType().toString() = "System.Web.UI.WebControls.Label" Then
' returnString = returnString & ctr.ID & "="
If (Not(Request.Form(ctr.ID) = "" OR Request.Form(ctr.ID) = "Select...")) AND (instr(ctr.ID,"Month") = 0 AND instr(ctr.ID,"Day") = 0 AND instr(ctr.ID,"Year") = 0) Then
If ctr.GetType().toString() = "System.Web.UI.WebControls.DropDownList" Then
myDDList = CType(ctr, DropDownList)
returnString = returnString & ctr.ID & "=" & myDDList.Items(myDDList.SelectedIndex).Text & "&"
returnString = returnString & ctr.ID & "=" & Request.Form(ctr.ID) & "&"
Response.redirect("ViewRecords.aspx?sort=cust_date &" & returnString)