Radnotification and reset value radtextbox

4 posts, 0 answers
  1. Fabio Cirillo
    Fabio Cirillo avatar
    180 posts
    Member since:
    Jan 2010

    Posted 18 Dec 2012 Link to this post

    Hi guys,
    i've created a page asp to process of change password....there are 3 radtextbox. One radtextbox for old password and two radtextbox for new and confirm password. When there's one error i use the radnotification for to see the message but when load the radnotification form code behind, the value into radtextbox are reset, why? how can do it?
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 18 Dec 2012 Link to this post

    Hi,

    I tried to replicate the issue that you are facing at my end under the version 2012, 3, 1016, 35 . But no avail. Following is the sample code that worked as expected at my end.

    ASPX:
    <telerik:RadTextBox ID="RadTextBox1" runat="server" AutoPostBack="true" OnTextChanged="RadTextBox1_TextChanged">
    </telerik:RadTextBox>
    <telerik:RadNotification ID="RadNotification1" runat="server" Text="RadNotification">
    </telerik:RadNotification>

    C#:
    protected void RadTextBox1_TextChanged(object sender, EventArgs e)
    {
        RadNotification1.Show();
    }

    Please provide your entire code where I can replicate the issue if it doesn't helps.

    Regards,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Fabio Cirillo
    Fabio Cirillo avatar
    180 posts
    Member since:
    Jan 2010

    Posted 18 Dec 2012 Link to this post

    into vb net i wrote this code:

    Protected Sub Txtpwdnewconf_TextChanged(sender As Object, e As System.EventArgs) Handles Txtpwdnewconf.TextChanged
        If Txtpwdnew.Text <> Txtpwdnewconf.Text Then
            Me.RadNotification1.Show("Conferma password non errata.")
        End If
    End Sub

    but nothing the problem there's...the values of the radtextbox (txtpwdnew and txtpwnconf) are reset after load event  Txtpwdnewconf_TextChanged
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 18 Dec 2012 Link to this post

    Hi,

    Since it is a password field it is the expected behavior for security reasons.All the other fields are saved in ViewState and repopulated on postback, but not password fields. One suggestion to retain the value is that you can show the RadNotification using the OnValueChanged client event as follows.

    ASPX:
    <telerik:RadTextBox ID="Txtpwdnew" runat="server" TextMode="Password">
    </telerik:RadTextBox>
    <telerik:RadTextBox ID="Txtpwdnewconf" runat="server" TextMode="Password" ClientEvents-OnValueChanged="OnValueChanged">
    </telerik:RadTextBox>
    <telerik:RadNotification ID="RadNotification1" runat="server" Text="RadNotification">
    </telerik:RadNotification>

    JS:
    <script type="text/javascript">
        function OnValueChanged(sender, args) {
            var Txtpwdnewconf = sender;
            var Txtpwdnew = $find("<%= Txtpwdnew.ClientID %>");
             var notification = $find("<%= RadNotification1.ClientID %>");
             if (Txtpwdnew.get_value() != Txtpwdnewconf.get_value()) {
                 notification.show();
             }
        }
    </script>

    Hope this helps.

    Regards,
    Princy.
Back to Top