protected void wizInstall_NextButtonClick(object sender, WizardNavigationEventArgs e)
        {
            try
            {
                int activeIndex = 0;
                switch (e.CurrentStepIndex)
                {
                case 0:
                    Panel             pnl          = (Panel)this.Step2.FindControl("pnlPackage");
                    GridView          grd          = (GridView)pnl.FindControl("gdvModule");
                    List <ModuleInfo> FinalModules = new List <ModuleInfo>();
                    foreach (GridViewRow row in grd.Rows)
                    {
                        CheckBox cbInstall = (CheckBox)row.FindControl("cbInstall");
                        if (cbInstall.Checked == true)
                        {
                            Label lbl = (Label)row.FindControl("lblname");
                            lstAvailableModules = (List <ModuleInfo>)ViewState["AvailableModuleList"];
                            foreach (ModuleInfo Module in lstAvailableModules)
                            {
                                if (Module.Name.Equals(lbl.Text))
                                {
                                    FinalModules.Add(Module);
                                    break;
                                }
                            }
                            ViewState["FinalModuleList"] = FinalModules;
                        }
                    }
                    if (FinalModules.Count > 1)
                    {
                        activeIndex             = 2;
                        this.lblLicense.Visible = false;
                    }
                    else if (FinalModules.Count == 1)
                    {
                        ModuleInfo Module     = (ModuleInfo)FinalModules[0];
                        string     SourcePath = Path.Combine(HostingEnvironment.ApplicationPhysicalPath, "Resources");
                        string     filename   = Path.Combine(SourcePath, Module.FolderName);
                        string     path       = HttpContext.Current.Server.MapPath("~/");
                        string     temPath    = SageFrame.Common.RegisterModule.Common.TemporaryFolder;
                        string     destPath   = Path.Combine(path, temPath);
                        Module.TempFolderPath = destPath;
                        installhelp.CopyModuleZipFiles(filename, destPath);
                        ArrayList list = installhelp.Step0CheckLogic(Module.FolderName, Module.TempFolderPath);
                        Module = (ModuleInfo)list[1];
                        installhelp.fillModuleInfo(Module);
                        this.lblReleaseNotesD.Text = Module.ReleaseNotes;
                        this.lblLicenseD.Text      = Module.License;
                        FinalModules = new List <ModuleInfo>();
                        FinalModules.Add(Module);
                        ViewState["FinalModuleList"] = FinalModules;
                        activeIndex = 1;
                    }

                    break;

                case 1:
                    activeIndex = 2;
                    break;

                case 2:    //Accept Terms
                    if (chkAcceptLicense.Checked)
                    {
                        ModuleInfo moduleInfo = null;
                        lstAvailableModules = (List <ModuleInfo>)ViewState["FinalModuleList"];
                        bool confirmationFlag = true;
                        foreach (ModuleInfo Module in lstAvailableModules)
                        {
                            if (lstAvailableModules.Count > 1)
                            {
                                string SourcePath = Path.Combine(HostingEnvironment.ApplicationPhysicalPath, "Resources");
                                string filename   = Path.Combine(SourcePath, Module.FolderName);
                                string path       = HttpContext.Current.Server.MapPath("~/");
                                string temPath    = SageFrame.Common.RegisterModule.Common.TemporaryFolder;
                                string destPath   = Path.Combine(path, temPath);
                                Module.TempFolderPath = destPath;
                                installhelp.CopyModuleZipFiles(filename, destPath);
                                ArrayList list = installhelp.Step0CheckLogic(Module.FolderName, Module.TempFolderPath);
                                moduleInfo = (ModuleInfo)list[1];
                                installhelp.fillModuleInfo(moduleInfo);
                            }
                            else if (lstAvailableModules.Count == 1)
                            {
                                moduleInfo = (ModuleInfo)Module;
                            }
                            installhelp.InstallPackage(moduleInfo);
                            if (moduleInfo.ModuleID < 0)
                            {
                                confirmationFlag = false;
                                InstallConfirmation(moduleInfo, ref activeIndex);
                                break;
                            }
                            if (confirmationFlag && moduleInfo != null)
                            {
                                InstallConfirmation(moduleInfo, ref activeIndex);
                            }
                        }
                    }
                    else
                    {
                        lblAcceptMessage.Text = GetSageMessage("Extensions", "AcceptThePackageLicenseAgreementFirst");
                        e.Cancel    = true;
                        activeIndex = 2;
                    }
                    break;

                case 3:
                    Bindgrid();
                    activeIndex = 0;
                    ViewState["FinalModuleList"]     = null;
                    ViewState["AvailableModuleList"] = null;
                    break;
                }
                wizInstall.ActiveStepIndex = activeIndex;
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }