Programming Entity Framework: Rough Cuts Version, Second Edition - O'Reilly Media
try the O'Reilly rough cuts to see books in development
Wednesday, 28 April 2010
Wednesday, 10 March 2010
Referencing ASP.NET Wizard Buttons
When you use the StepType of Finish a Finish Button is automatically generated and its ID is “FinishButton”, e.g. the WizardStep looks like this:
<asp:WizardStep ID="ConfirmWizardStep" runat="server" Title="Confirm" StepType="Finish">
Due to a business rule you may wish to disable the Finish button and to do this you would think that a FindControl on the WizardStep would work but it doesn’t as the Button is nested below many other tables/templates etc.
The method I used involved a custom recursive FindControl function as follows:
Dim finishButton As Button = CType(FindControlRecursive(WizardControl, "FinishButton"), Button)
Public Shared Function FindControlRecursive(ByVal root As Control, ByVal id As String) As Control
If root.ID = id Then
Return root
End If
Dim c As Control
For Each c In root.Controls
Dim t As Control = FindControlRecursive(c, id)
If Not t Is Nothing Then
Return t
End If
Next
Return Nothing
Function
Subscribe to:
Posts (Atom)