Authorize action

3 posts, 0 answers
  1. Stephen
    Stephen avatar
    4 posts
    Member since:
    Apr 2012

    Posted 24 Aug 2012 Link to this post

    I have an employee profile that contains sensitive fields such as passwords and identification numbers. By default, the fields are masked so the values are hidden, but noticeably present. In order to see these fields' data, the user clicks a RadButton configured as a check box to change it's checked state to true (show passwords).

    I wired up a function to launch a function:
    function openPasswordWin() {
         var oWnd = radopen("frmConfirmShowPassword.aspx", "RadWindow1");
    }

    When that form closes, I get the entered user name and password and authenticate their access. All fine and dandy, works well.

    The problem is that after the user does this, I am having trouble on subsequent check changes. The user does not need to be reauthenticated during the session, but gettting the handlers to unhook or hook up hasn't been working. This is what I've tried:
    'This is in the Page_Load method
    If Session("ShowPassword") Is Nothing Then
        chkShowPassword.Attributes.Remove("onclick")
        chkShowPassword.Attributes.Add("onclick", "openPasswordWin(); return false;")
        RemoveHandler chkShowPassword.CheckedChanged, AddressOf chkShowPassword_CheckedChanged
    Else
        If Session("ShowPassword") = "0" Then
           chkShowPassword.Attributes.Remove("onclick")
           chkShowPassword.Attributes.Add("onclick", "openPasswordWin(); return false;")
           RemoveHandler chkShowPassword.CheckedChanged, AddressOf chkShowPassword_CheckedChanged
        Else
           chkShowPassword.Attributes.Remove("onclick")
           AddHandler chkShowPassword.CheckedChanged, AddressOf chkShowPassword_CheckedChanged
           chkShowPassword.Attributes.Add("onclick", "chkShowPassword_CheckedChanged")
         End If
    End If

    The results are inconsistent in getting the click event of the check box button to fire, adding the handler doesn't seem to work. Any suggestions?

    Thanks in advance,
    Sn
  2. Slav
    Admin
    Slav avatar
    1356 posts

    Posted 29 Aug 2012 Link to this post

    Hello Stephen,

    The RadButton control has two client-side events that should be used when handling the button click event on the client - OnClientClicking and OnClientClicked. Please check the following help articles that contain more useful information on handling these events:

    I hope this helps. Feel free to contact us again if you run into more difficulties.


    Kind regards,
    Slav
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Stephen
    Stephen avatar
    4 posts
    Member since:
    Apr 2012

    Posted 29 Aug 2012 Link to this post

    OK, so I handle the OnClientClicking event and check to see if the session variable is set. If it is, cancel the event so OnClientClicked doesn't fire, otherwise, let it continue on through to the OnClientClicked event. Hmm, seems too simple. I'll code it later today...

    Thanks, Slav!
Back to Top