My ASP.NET Web Form has a RadTabStrip with 3 different tabs. The first tab has the username and password, the second tab has the permissions, and the third tab has the clients. The username and password have RequiredFieldValidators on them.
I have noticed that whenever I go from one tab to another, the Windows TextBox Control txtPassword's Text field is getting reset, causing the page to not validate whenever tabs 2 or 3 are shown.
I created a hack to fix this:
Protected Sub RadTabStrip1_ClientTabSelecting(sender As Object, e As RadTabStripEventArgs) Handles RadTabStrip1.TabClick
Page.Validate()
If Me.IsValid() Then
If Not String.IsNullOrWhiteSpace(txtPassword.Text) Then
ViewState("password") = txtPassword.Text
End If
Else
If String.IsNullOrWhiteSpace(txtPassword.Text) Then
txtPassword.Text = ViewState("password")
End If
If String.IsNullOrWhiteSpace(txtConfirmPassword.Text) Then
txtConfirmPassword.Text = ViewState("password")
End If
Page.Validate()
If Not IsValid() Then
MultiView1.ActiveViewIndex = 1
RadTabStrip1.SelectedIndex = 0
RadMultiPage1.SelectedIndex = 0
End If
End If
End Sub
I do not like storing their password in the ViewState, but it works.
Almost.
The Submit button is on the bottom of the page, contained within a RadToolBar.
Protected Sub RadToolBar1_ButtonClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadToolBarEventArgs) Handles RadToolBar1.ButtonClick
Dim rb As Telerik.Web.UI.RadToolBarButton = e.Item
Dim clientList As List(Of Client) = ViewState("MyClientList")
If rb.CommandName = "Save" Then
There is a breakpoint on that line of code, but Validation fails before that code is reached.
By this point, my customers are on Tab 3, and they have no way to tell that the txtPassword control has had their input deleted on Tab 1.
Has anyone ever experienced a Windows Control like this password getting cleared whenever the RadTabStrip Index changes?
How do I fix this?