If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Web Controls not updating

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-24-03, 13:59
kw.wainwright kw.wainwright is offline
Registered User
 
Join Date: Oct 2003
Location: Maryland
Posts: 21
Question Web Controls not updating

Ok, so here is my problem:

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

' Concat Date Fields

CustomerDate.Text = CustomerDateMonth.SelectedIndex & "/" & CustomerDateDay.SelectedItem.toSTring() _
& "/" & CustomerDateYear.SelectedItem.toString()
LogDate.Text = LogDateMonth.SelectedIndex & "/" & LogDateDay.SelectedItem.toString() _
& "/" & LogDateYear.SelectedItem.toString()
SentToRMB.Text = SentToRMBMonth.SelectedIndex & "/" & SentToRMBDay.SelectedItem.toString() _
& "/" & SentToRMBYear.SelectedItem.toString()
RcvdFromRMB.Text = RcvdFromRMBMonth.SelectedIndex & "/" & RcvdFromRMBDay.SelectedItem.toString() _
& "/" & RcvdFromRMBYear.SelectedItem.toString()
DateOrdered.Text = DateOrderedMonth.SelectedIndex & "/" & DateOrderedDay.SelectedItem.toString() _
& "/" & DateOrderedYear.SelectedItem.toString()
DateOrderRcvd.Text = DateOrderRcvdMonth.SelectedIndex & "/" & DateOrderRcvdDay.SelectedItem.toString() _
& "/" & DateOrderRcvdYear.SelectedItem.toString()
DatePaidinFull.Text = DatePaidinFullMonth.SelectedIndex & "/" & DatePaidinFullDay.SelectedItem.toString() _
& "/" & DatePaidinFullYear.SelectedItem.toString()

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 & "="
Else
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 & "&"
Else
returnString = returnString & ctr.ID & "=" & Request.Form(ctr.ID) & "&"
End If
End If
End If
End If
Next

Response.redirect("ViewRecords.aspx?sort=cust_date &" & returnString)
End Sub
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On