|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi, I have the following problem:
On a webform I have some textboxes and combo boxes and a button. All of them are web controls. Some of them are disabled. When I click the submit button, I update in the database the modified fields, and I show the same page with the updated fields and a message. I update only the enabled fields, I don't touch the disabled fields. After the update is made, the disabled fields are empty. I assume is because the .Net can't take the disabled field's value (like in HTML). I can use ReadOnly instead of Enabled, but is not ok for combos. Has anybody a solution? I would need a solution asap. Thanks in advance |
|
#2
|
|||
|
|||
|
While not necessarily the "best" option, you could always loop thru the posted collection like this also :
Code:
Dim arr1() As String
Dim arr2() As String
Dim l1 As Integer = 0
Dim l2 As Integer = 0
Dim aCount As Integer = 0
Dim coll As System.Collections.Specialized.NameValueCollection
coll = HttpContext.Current.Request.Form
arr1 = coll.AllKeys
For l1 = 0 To arr1.GetUpperBound(0)
arr2 = coll.GetValues(l1)
For l2 = 0 To arr2.GetUpperBound(0)
If Not arr2(l2) Is Nothing Then
If arr2(l2) <> String.Empty Then
Context.Current.Response.Write("<br />Name : " + arr1(l1) + " -- Value : " + arr2(l2))
End If
End If
Next
Next
|
|
#3
|
|||
|
|||
|
Running this code I got only the enabled controls with thei values.
|
|
#4
|
|||
|
|||
|
You will always only get the enabled controls. There is no getting around that.
|
![]() |
| Viewing: ASP Free Forums > Programming > .NET Development > webform update problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|