ChangePasswordForm design mode exception
Hi,
After creating a new project, adding a page with a Telerik.Sitefinity.Security.Web.UI.ChangePasswordForm control I get a System.IndexOutOfRangeException when trying to edit the page again. When I first added the control, it had the DisplayUserName property in False, but it shows the field anyway.
I need to provide my Front end users the ability to change their passwords. Any suggestions?
Thanks in advance
Hello Pablo,
Thanks a lot for reporting this issue. To workaround the exception, you could create your own control overriding Telerik.Sitefinity.Security.Web.UI.ChangePasswordForm like this:
using
Telerik.Sitefinity.Security.Web.UI;
using
System.Web.UI;
namespace
SitefinityWebApp
public
class
CustomChangePasswordForm : ChangePasswordForm
protected
override
void
CreateChildControls()
base
.CreateChildControls();
var changePasswordContainer =
this
.FindControl(
"ChangePasswordContainerID"
)
as
ChangePasswordContainer;
if
(changePasswordContainer !=
null
)
changePasswordContainer.UserNameTextBox.Visible =
this
.DisplayUserName;
var userNameLabel = changePasswordContainer.FindControl(
"UserNameLabel"
);
if
(userNameLabel !=
null
)
userNameLabel.Visible =
this
.DisplayUserName;
protected
override
object
SaveViewState()
object
[] objArray =
new
object
[]
null
, (
this
.MailDefinition !=
null
) ? ((IStateManager)
this
.MailDefinition).SaveViewState() :
null
;
for
(
int
i = 0; i < objArray.Length - 1; i++)
if
(objArray[i] !=
null
)
return
objArray;
return
null
;