This is a migrated thread and some comments may be shown as answers.

Authorize action

2 Answers 64 Views
Button
This is a migrated thread and some comments may be shown as answers.
Stephen
Top achievements
Rank 1
Stephen asked on 24 Aug 2012, 02:38 PM
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 Answers, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 29 Aug 2012, 12:02 PM
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.
0
Stephen
Top achievements
Rank 1
answered on 29 Aug 2012, 12:14 PM
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!
Tags
Button
Asked by
Stephen
Top achievements
Rank 1
Answers by
Slav
Telerik team
Stephen
Top achievements
Rank 1
Share this question
or