コード例 #1
0
        void grdStyles_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridView grid = (GridView)sender;
            Guid     guid = new Guid(grid.DataKeys[e.RowIndex].Value.ToString());

            TextBox  txtName     = (TextBox)grid.Rows[e.RowIndex].Cells[1].FindControl("txtName");
            TextBox  txtElement  = (TextBox)grid.Rows[e.RowIndex].Cells[2].FindControl("txtElement");
            TextBox  txtCssClass = (TextBox)grid.Rows[e.RowIndex].Cells[3].FindControl("txtCssClass");
            CheckBox chkIsActive = (CheckBox)grid.Rows[e.RowIndex].Cells[4].FindControl("chkIsActive");

            ContentStyle style;


            if (guid != Guid.Empty)
            {
                style = ContentStyle.Get(guid);
            }
            else
            {
                style          = ContentStyle.GetNew(siteSettings.SiteGuid);
                style.SkinName = siteSettings.Skin;
            }

            if (style != null)
            {
                SiteUser currentUser = SiteUtils.GetCurrentSiteUser();
                if (currentUser != null)
                {
                    style.LastModBy = currentUser.UserGuid;
                }
                style.Name     = txtName.Text;
                style.Element  = txtElement.Text;
                style.CssClass = txtCssClass.Text;
                style.IsActive = chkIsActive.Checked;
                style.Save();
            }


            WebUtils.SetupRedirect(this, Request.RawUrl);
        }