Wizard里的button事件

 1    
 2    protected void Page_Load(object sender, EventArgs e)
 3    {
 4        //向导控件
 5        //动态添加事件
 6        
 7        Wizard.NextButtonClick += new WizardNavigationEventHandler(Wizard_NextButtonClick);//下一步
 8        Wizard.PreviousButtonClick += new WizardNavigationEventHandler(Wizard_PreviousButtonClick);//上一步
 9        Wizard.ActiveStepChanged += new EventHandler(Wizard_ActiveStepChanged);//改变步骤时一事件
10        Wizard.FinishButtonClick +=new WizardNavigationEventHandler(Wizard_FinishButtonClick);//完成
11        if (!IsPostBack)
12        {
13            BindData();  
14        }
 
15           
16    }

17
18
19    void Wizard_NextButtonClick(object sender, WizardNavigationEventArgs e)
20    {
21        e.Cancel = true;
22        try
23        {
24            switch (e.CurrentStepIndex)
25            {
26                case 0:
27                    if(ChkInstall())
28                        e.Cancel = false;
29                    break;
30                case 1:
31                    if (UpdateConfig())
32                        e.Cancel = false;
33                    break;
34               
35                case 2:
36                    if (DatabaseConfig())
37                        e.Cancel = false;
38                    break;
39                case 3:
40                    if (UpgradeDatabase())
41                        e.Cancel = false;
42                  
43                    Wizard.StepPreviousButtonStyle.CssClass = "hide" ;
44                    break;
45                case 4:
46                    if (SetAdmin())
47                        e.Cancel = false;
48                    break;
49            }

50        }

51        catch (Exception x)
52        {
53             //throw x;
54            e.Cancel = true;
55            AddLoadMessage(x.Message);
56        }

57       
58    }

59
60
61    void Wizard_PreviousButtonClick(object sender, WizardNavigationEventArgs e)
62    {
63        BindData();   //上一步时绑定数据
64    }

65
66    void Wizard_ActiveStepChanged(object sender, EventArgs e)
67    {
68       // Wizard.ActiveStepIndex++;
69    }

70
71    protected void Wizard_FinishButtonClick(object sender, WizardNavigationEventArgs e)
72    {
73        Response.Redirect("~/");
74    }
posted @ 2008-03-14 12:27  yellowwood  阅读(446)  评论(0编辑  收藏  举报
Never Give UP