コード例 #1
0
        //****************************************************************
        //
        // The UpdateBtn_Click event handler on this Page is used to either
        // create or update a link.  It  uses the ASPNetPortal.LinkDB()
        // data component to encapsulate all data functionality.
        //
        //****************************************************************

        private void UpdateBtn_Click(Object sender, EventArgs e)
        {
            if (Page.IsValid == true)
            {
                AdminDB admin = new AdminDB();

                if (defId == -1)
                {
                    // Obtain PortalSettings from Current Context
                    PortalSettings portalSettings = (PortalSettings)Context.Items["PortalSettings"];

                    // Add a new module definition to the database
                    admin.AddModuleDefinition(portalSettings.PortalId, FriendlyName.Text, DesktopSrc.Text, MobileSrc.Text);
                }
                else
                {
                    // update the module definition
                    admin.UpdateModuleDefinition(defId, FriendlyName.Text, DesktopSrc.Text, MobileSrc.Text);
                }

                // Redirect back to the portal admin page
                Response.Redirect("~/DesktopDefault.aspx?tabindex=" + tabIndex + "&tabid=" + tabId);
            }
        }