Pourquoi ce code ne fonctionne pas à l'intérieur UpdatePanel
contrôles que j'ai dans: quatre CheckBoxe
formulaire en ligne s et un TextBox
pourquoi ce codage ne fonctionne pas à l'intérieur de updatepanel?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim str As String = Nothing
Dim id As String = Nothing
Dim ch As String = Nothing
For Each ctrl As Control In UpdatePanel1.Controls
If ctrl.GetType() Is GetType(CheckBox) Then
Dim chk As CheckBox = ctrl
If chk.Checked = True Then
If TextBox1.Text = "" Then
TextBox1.Text = chk.ID
Else
Dim SearchString As String = chk.ID
id = TextBox1.Text
If id.Contains(SearchString) <> -1 Then
TextBox1.Text = TextBox1.Text + "," + chk.ID
Else
End If
End If
Else
Dim SearchString As String = chk.ID
id = TextBox1.Text
If id.Contains(SearchString) <> -1 Then
Else
id = RemoveSubString(id, chk.ID)
TextBox1.Text = id
End If
End If
End If
Next
End Sub
Private Function RemoveSubString(ByVal stringvalue As String, ByVal stringremove As String) As String
Dim pos As Integer = stringvalue.IndexOf(stringremove)
If pos > 0 Then
Return stringvalue.Remove(pos - 1, stringremove.Length + 1)
ElseIf pos = 0 Then
If stringvalue.Contains(",") <> -1 Then
Return stringvalue.Remove(pos, stringremove.Length)
Else
Return stringvalue.Remove(pos, stringremove.Length + 1)
End If
End If
Return stringvalue
End Function
codage fonctionnait très bien en dehors du UpdatePanel
... mais pas travailler à l'intérieur panneau de mise à jour ... ce a t-il tort?
Pas besoin de crier, sauf si vous avez dépassé votre date limite. ALL CAPS est en ligne criant. DONT –
@astander OP peut ne pas être au courant! Tu pourrais mieux le changer? –
@Quintin Robinson l'a déjà fait. –