Home All Groups Group Topic Archive Search About

Disable the prev button in a wizard

Author
27 Jan 2007 11:38 PM
David Thielen
Hi;

How can I disable the prev button in a wizard from my C# code behind? On the
last page a prev is not allowed.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm

Author
29 Jan 2007 4:10 AM
Walter Wang [MSFT]
Hi Dave,

You could control the visibility using CSS:

<head runat="server">
    <title>Untitled Page</title>
    <style type="text/css">
    .hidden { display: none; }
    .visible { display: inline; }
    </style>
</head>



    protected void Wizard1_ActiveStepChanged(object sender, EventArgs e)
    {
        if (Wizard1.ActiveStepIndex == 1)
        {
            Wizard1.StepPreviousButtonStyle.CssClass = "hidden";
        }
        else
        {
            Wizard1.StepPreviousButtonStyle.CssClass = "visible";
        }
    }


Hope this helps.


Regards,
Walter Wang (waw***@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Author
29 Jan 2007 4:15 AM
Walter Wang [MSFT]
Dave,

I just realized your question is to disable instead of hide. Since the
button is not exposed as a public property, you could use your own
FinishNavigationTemplate and disable the button inside it:

            <FinishNavigationTemplate>
                <asp:Button id="btnPrev" runat="server"
CommandName="MovePrevious" Enabled="false" Text="Previous" />
                <asp:Button ID="btnFinish" runat="server"
CommandName="MoveComplete" Text="Finish" />
            </FinishNavigationTemplate>

You could find these required CommandName in documentation of
FinishNavigateTemplate.


Regards,
Walter Wang (waw***@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.