RadTextBox TextMode = Password not work properly

4 posts, 0 answers
  1. Chamin
    Chamin avatar
    10 posts
    Member since:
    Mar 2012

    Posted 27 Jun 2012 Link to this post

    I have created textbook dynamically as follows,

    Dim control As New RadTextBox()
    control.ID = "txtpassword"
    control.Text = obj.FieldValue
    control.CssClass = obj.CssClass
    control.WrapperCssClass = obj.WrapperCssClass
    control.AutoPostBack = obj.IsAutoPostBack
    control.TextMode = obj.TextMode
    for the password I have pass the value '2' for textmode.

    Actually I have create the control on page load. But i can't see the text which I pass to the control(expected to see ************).
    But text will be empty.
    Please guide me to avoid this issue.
  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 27 Jun 2012 Link to this post

    Hello Chamin,

    I'm assuming you're problem is in reading the value during some postback. If that is the case, are you re-creating the textbox on every postback? If not, you will need to do in order for the ViewState to sync up its values with the control.

    I hope that helps.
  3. DevCraft R3 2016 release webinar banner
  4. Chamin
    Chamin avatar
    10 posts
    Member since:
    Mar 2012

    Posted 27 Jun 2012 Link to this post

    Hi Kevin,

    This is happen when initial page request is made. Not in postback only.
    Actualy all other controls (radtextbox, radcombobox, radntextbox) are created on dynamically. these controls are working perfectly. I have only problem in this password radtextbox only.

    Thanks & Best Regards,
  5. Vasil
    Vasil avatar
    1541 posts

    Posted 28 Jun 2012 Link to this post

    Hi Chamin,

    Yes, in password mode the text will not be sent to client, this is done with security concern. I think the same behaviour has the asp:TextBox as well.

    When you have password input in your page, you should expect the user to enter it, and you should not ever send it to the client. Moreover you should not store the password in clear view server side, and need store hash of the password, but that is a long story.

    If you do some validation, for example have registration form and the user was not filled something that is required, the next postback does not send him the password, just store this password for you in the session if you like. And on the next postback if the password is empty read it from the session. Or if it is not empty, then the user has changed it, so read it from the input value.

    You can set some empty message to the TextBox like and it will looks like it is filled.

    Kind regards,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top