示例#1
0
        protected void gvErrorPages_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            // fill dropdown
            DropDownList ddlHandlerType = (DropDownList)e.Row.FindControl("ddlHandlerType");

            if (ddlHandlerType != null)
            {
                if (IIs7)
                {
                    // IIS 7
                    ddlHandlerType.Items.Add(new ListItem(GetLocalizedString("IIS7.File"), "File"));
                    ddlHandlerType.Items.Add(new ListItem(GetLocalizedString("IIS7.Redirect"), "Redirect"));
                    ddlHandlerType.Items.Add(new ListItem(GetLocalizedString("IIS7.ExecuteURL"), "ExecuteURL"));
                }
                else
                {
                    // IIS 6
                    ddlHandlerType.Items.Add(new ListItem(GetLocalizedString("IIS6.FILE"), "FILE"));
                    ddlHandlerType.Items.Add(new ListItem(GetLocalizedString("IIS7.URL"), "URL"));
                    ddlHandlerType.Items.Add(new ListItem(GetLocalizedString("IIS7.Default"), "Default"));
                }

                ddlHandlerType.SelectedValue = ((HttpError)e.Row.DataItem).HandlerType;
            }

            StyleButton cmdDelete = (StyleButton)e.Row.FindControl("cmdDelete");

            if (cmdDelete != null)
            {
                cmdDelete.CommandArgument = e.Row.RowIndex.ToString();
            }
        }
        protected void gvCustomHeaders_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            StyleButton cmdDelete = (StyleButton)e.Row.FindControl("cmdDelete");

            if (cmdDelete != null)
            {
                cmdDelete.CommandArgument = e.Row.RowIndex.ToString();
            }
        }
        protected void gvUsers_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            StyleButton cmdDelete = (StyleButton)e.Row.FindControl("cmdDelete");
            CheckBox    chkAdmin  = (CheckBox)e.Row.FindControl("chkAdmin");

            if (cmdDelete != null)
            {
                cmdDelete.CommandArgument = e.Row.RowIndex.ToString();
            }

            StatsUser user = (StatsUser)e.Row.DataItem;

            if (user != null && user.IsOwner)
            {
                cmdDelete.Visible = false;
                chkAdmin.Enabled  = false;
            }
        }