views:

1126

answers:

3

I'm considering using the ChangePassword control on an ASP.NET 2.0 Webform. I don't want the 'cancel' button to show.

Is there a good way to hide it without resorting to silly "width = 0" sort of games?

Or perhaps there's a generic way to walk through the parts of a composite control like this and hide individual parts?

+1  A: 

You can use the ChangePassword.CancelButtonStyle Property to set the CSS-class on the Cancel Button. Then just apply "display: none" on the specified class.

Espo
+4  A: 

Set CancelButtonStyle.CssClass to something like "hiddenItem" and set the CSS to "display:none".

Otherwise you can convert the control to a template and simply delete away the cancel-button manually. When you click the control in Design-mode in Visual Studio, you get a little arrow with options and one of them is "Convert to Template".

Seb Nilsson
+1  A: 

A quick an easy way just using your .aspx page is to set these cancel button properties on the changepassword control:

CancelButtonType="Link" CancelButtonText=""