/// <summary>
        /// Initializes a new instance of the <see cref="T:LanguageGrid"/> class.
        /// </summary>
        public LanguageGrid()
        {
            AutoGenerateColumns = false;

            TemplateColumn colUILang = new TemplateColumn();
            colUILang.HeaderText = General.GetString("LANG_SWITCH_UI_LANGUAGE", "UI Language");
            //colUILang.ItemTemplate = new LanguagesTemplateDropDown(ListItemType.Item, "Language", CultureTypes.AllCultures);
            colUILang.ItemTemplate = new LanguagesTemplateDropDown(ListItemType.Item, CultureTypes.AllCultures);
            Columns.Add(colUILang);

            TemplateColumn colCulture = new TemplateColumn();
            colCulture.HeaderText = General.GetString("LANG_SWITCH_CULTURE", "Culture");
            //colCulture.ItemTemplate = new LanguagesTemplateDropDown(ListItemType.Item, "Culture", CultureTypes.SpecificCultures);
            colCulture.ItemTemplate = new LanguagesTemplateDropDown(ListItemType.Item, CultureTypes.SpecificCultures);
            Columns.Add(colCulture);

            ButtonColumn colDelete = new ButtonColumn();
            colDelete.Text = General.GetString("LANG_SWITCH_DELETE", "Delete");
            colDelete.CommandName = "Delete";
            Columns.Add(colDelete);

            ButtonColumn colAdd = new ButtonColumn();
            colAdd.Text = General.GetString("LANG_SWITCH_Add", "Add");
            colAdd.CommandName = "Add";
            Columns.Add(colAdd);
        }
      private void Page_Load(object sender, EventArgs e)
      {
          HtmlForm form1 = (HtmlForm)this.FindControl("Form1");

          this.GHTTestBegin(form1);
          base.GHTActiveSubTest = this.GHTSubTest1;
          try
          {
              this.DataGrid1.DataSource = GHDataSources.DSDataTable();
              ButtonColumn column2 = new ButtonColumn();
              ButtonColumn column3 = new ButtonColumn();
              ButtonColumn column1 = new ButtonColumn();
              column2.DataTextField = "ID";
              column3.DataTextField = "Name";
              column1.DataTextField = "Company";
              this.DataGrid1.Columns.Add(column2);
              this.DataGrid1.Columns.Add(column3);
              this.DataGrid1.Columns.Add(column1);
              this.DataGrid1.DataBind();
          }
          catch (Exception exception2)
          {
              Exception exception1 = exception2;
              this.GHTSubTestUnexpectedExceptionCaught(exception1);
          }
          this.GHTTestEnd();
      }
        public void Defaults()
        {
            ButtonColumn bc = new ButtonColumn();

            Assert.AreEqual("", bc.ValidationGroup, "ValidationGroup");
            Assert.AreEqual(false, bc.CausesValidation, "CausesValidation");
        }
Beispiel #4
0
        /// <summary>
        /// Loads the coupons.
        /// </summary>
        private void LoadCoupons()
        {
            CouponCollection couponCollection = new CouponController().FetchAll();

            if (couponCollection.Count == 0)
            {
                Master.MessageCenter.DisplayInformationMessage(LocalizationUtility.GetText("lblNoCouponsConfigured"));
                dgCoupons.Visible = false;
            }
            else
            {
                dgCoupons.DataSource     = couponCollection;
                dgCoupons.ItemDataBound += dgCoupons_ItemDataBound;
                HyperLinkColumn hlEditColumn = dgCoupons.Columns[0] as HyperLinkColumn;
                if (hlEditColumn != null)
                {
                    hlEditColumn.Text = LocalizationUtility.GetText("lblEdit");
                    hlEditColumn.DataNavigateUrlFormatString = "~/admin/coupons.aspx?couponId={0}";
                }
                dgCoupons.Columns[0].HeaderText = LocalizationUtility.GetText("hdrEdit");
                dgCoupons.Columns[1].HeaderText = LocalizationUtility.GetText("hdrCouponCode");
                dgCoupons.Columns[2].HeaderText = LocalizationUtility.GetText("hdrExpirationDate");
                dgCoupons.Columns[3].HeaderText = LocalizationUtility.GetText("hdrType");
                dgCoupons.Columns[4].HeaderText = LocalizationUtility.GetText("hdrDelete");

                ButtonColumn btnColumn = dgCoupons.Columns[4] as ButtonColumn;
                if (btnColumn != null)
                {
                    btnColumn.Text = LocalizationUtility.GetText("lblDelete");
                }
                dgCoupons.DataBind();
            }
        }
            // Add Edit and Delete columns
            private void AddWorkerColumns()
            {
                if (ShowWebdings)
                {
                    EditColumnText       = "/";
                    EditColumnUpdateText = "R";
                    EditColumnCancelText = "T";
                    DeleteColumnText     = "r";
                }

                // Edit column
                EditCommandColumn editColumn = new EditCommandColumn();

                editColumn.EditText   = EditColumnText;
                editColumn.UpdateText = EditColumnUpdateText;
                editColumn.CancelText = EditColumnCancelText;
                if (ShowWebdings)
                {
                    editColumn.ItemStyle.Font.Size = 11;
                    editColumn.ItemStyle.Font.Name = "wingdings 2";
                }
                Columns.Add(editColumn);


                // Delete column
                ButtonColumn deleteColumn = new ButtonColumn();

                deleteColumn.CommandName = "delete";
                deleteColumn.Text        = DeleteColumnText;
                if (ShowWebdings)
                {
                    deleteColumn.ItemStyle.Font.Name = "webdings";
                }
                Columns.Add(deleteColumn);
            }
Beispiel #6
0
        private DataGridColumn c_button()
        {
            ButtonColumn column1 = new ButtonColumn();

            column1.DataTextField = "ID";
            return(column1);
        }
        private DataGridColumn c_button(bool v)
        {
            ButtonColumn column1 = new ButtonColumn();

            column1.DataTextField = "ID";
            column1.Visible       = v;
            return(column1);
        }
        private DataGridColumn c_button(string se)
        {
            ButtonColumn column1 = new ButtonColumn();

            column1.DataTextField  = "ID";
            column1.SortExpression = se;
            return(column1);
        }
Beispiel #9
0
        private DataGridColumn c_button(string se)
        {
            ButtonColumn column1 = new ButtonColumn();

            column1.DataTextField  = "ID";
            column1.HeaderImageUrl = se;
            return(column1);
        }
        private DataGridColumn c_button(ListItemType tp, string text)
        {
            ButtonColumn column1 = new ButtonColumn();

            column1.DataTextField = "ID";
            this.setStyle(column1, tp);
            this.setText(column1, tp, text);
            return(column1);
        }
Beispiel #11
0
        public void LoadDeleteColumn()
        {
            ButtonColumn buttonColumn = new ButtonColumn();

            buttonColumn.SortExpression  = "desc";
            buttonColumn.CommandName     = "Delete";
            buttonColumn.Text            = "删除";
            buttonColumn.ItemStyle.Width = 70;
            this.Columns.AddAt(1, buttonColumn);
        }
Beispiel #12
0
        /// <summary>
        /// 加载删除列
        /// </summary>
        public void LoadDeleteColumn()
        {
            ButtonColumn bc = new ButtonColumn();

            bc.SortExpression = "desc";
            bc.CommandName    = "Delete";
            bc.Text           = "删除";
            //bc.FooterText="添加";
            bc.ItemStyle.Width = 70;
            this.Columns.AddAt(1, bc);//增加按钮列
        }
        public void AssignedProperties()
        {
            ButtonColumn bc = new ButtonColumn();

            Assert.AreEqual("", bc.ValidationGroup, "ValidationGroup#1");
            bc.ValidationGroup = "test";
            Assert.AreEqual("test", bc.ValidationGroup, "ValidationGroup#2");
            Assert.AreEqual(false, bc.CausesValidation, "CausesValidation#1");
            bc.CausesValidation = true;
            Assert.AreEqual(true, bc.CausesValidation, "CausesValidation#2");
        }
Beispiel #14
0
        public void AddDeleteColumn()
        {
            ButtonColumn btnColumn = new ButtonColumn();

            btnColumn.ButtonType           = ButtonColumnType.LinkButton;
            btnColumn.Text                 = "Delete";
            btnColumn.CommandName          = "Delete";
            btnColumn.HeaderText           = "<strong>Delete</strong>";
            btnColumn.HeaderStyle.CssClass = "ms-TPHeader";
            btnColumn.ItemStyle.CssClass   = "ms-alternating";
            this.Columns.Add(btnColumn);
        }
Beispiel #15
0
    // <Snippet1>
    private void Page_Init(Object sender, EventArgs e)
    {
        // Create dynamic column to add to Columns collection.
        ButtonColumn AddColumn = new ButtonColumn();

        AddColumn.HeaderText  = "Add Item";
        AddColumn.Text        = "Add";
        AddColumn.CommandName = "Add";
        AddColumn.ButtonType  = ButtonColumnType.PushButton;

        // Add column to Columns collection.
        ItemsGrid.Columns.AddAt(2, AddColumn);
    }
Beispiel #16
0
        /// <summary>
        /// Sets the provider list.
        /// </summary>
        private void SetProviderList()
        {
            ProviderCollection providerCollection = new ProviderController().
                                                    FetchByProviderType(this.ProviderType);

            if (providerCollection.Count > 0)
            {
                pnlProviderList.Visible           = true;
                dgProviders.DataSource            = providerCollection;
                dgProviders.ItemDataBound        += new DataGridItemEventHandler(dgProviders_ItemDataBound);
                dgProviders.Columns[0].HeaderText = LocalizationUtility.GetText("hdrEdit");
                dgProviders.Columns[1].HeaderText = LocalizationUtility.GetText("hdrName");
                dgProviders.Columns[2].HeaderText = LocalizationUtility.GetText("hdrConfigurationControlPath");
                dgProviders.Columns[3].HeaderText = LocalizationUtility.GetText("hdrDelete");

                HyperLinkColumn hlEditColumn = dgProviders.Columns[0] as HyperLinkColumn;
                if (hlEditColumn != null)
                {
                    hlEditColumn.Text = LocalizationUtility.GetText("lblEdit");
                    switch (this.ProviderType)
                    {
                    case ProviderType.PaymentProvider:
                        hlEditColumn.DataNavigateUrlFormatString = "~/admin/paymentprovidermanagement.aspx?providerId={0}";
                        break;

                    case ProviderType.ShippingProvider:
                        hlEditColumn.DataNavigateUrlFormatString = "~/admin/shippingprovidermanagement.aspx?providerId={0}";
                        break;

                    case ProviderType.TaxProvider:
                        hlEditColumn.DataNavigateUrlFormatString = "~/admin/taxprovidermanagement.aspx?providerId={0}";
                        break;

                    case ProviderType.CouponProvider:
                        hlEditColumn.DataNavigateUrlFormatString = "~/admin/couponprovidermanagement.aspx?providerId={0}";
                        break;
                    }
                }
                ButtonColumn btnColumn = dgProviders.Columns[3] as ButtonColumn;
                if (btnColumn != null)
                {
                    btnColumn.Text = LocalizationUtility.GetText("lblDelete");
                }
                dgProviders.DataBind();
            }
            else
            {
                pnlProviderList.Visible = false;
                base.MasterPage.MessageCenter.DisplayInformationMessage(SetNoProvidersLabel());
            }
        }
Beispiel #17
0
        /// <summary>
        /// Raises the PaintCell event
        /// </summary>
        /// <param name="e">A PaintCellEventArgs that contains the event data</param>
        public override void OnPaintCell(PaintCellEventArgs e)
        {
            if (e.Table.ColumnModel.Columns[e.Column] is ButtonColumn)
            {
                ButtonColumn buttonCol = ((ButtonColumn)e.Table.ColumnModel.Columns[e.Column]);
                this.ImageAlignment = buttonCol.ImageAlignment;
                this.FlatStyle      = buttonCol.FlatStyle;
            }
            else
            {
                this.ImageAlignment = System.Drawing.ContentAlignment.MiddleLeft;
            }

            base.OnPaintCell(e);
        }
Beispiel #18
0
 public int FindButtonColumnIndex(string CommandName)
 {
     for (int Result = 0; Result < Columns.Count; Result++)
     {
         DataGridColumn DataColumn = Columns[Result];
         if (DataColumn is ButtonColumn)
         {
             ButtonColumn DataButtonColumn = (ButtonColumn)DataColumn;
             if (DataButtonColumn.CommandName == CommandName)
             {
                 return(Result);
             }
         }
     }
     return(-1);
 }
Beispiel #19
0
 protected void InitButtonColumn(bool image, ButtonColumnType type, string commandName, string text, string dataTextField, string dataFormatString, string footerText, string headerText, string LocationImage, string Sort, bool Visible)
 {
     System.Web.UI.WebControls.ButtonColumn ButtonColumToAdd = new ButtonColumn();
     ButtonColumToAdd.ButtonType           = type;
     ButtonColumToAdd.CommandName          = commandName;
     ButtonColumToAdd.DataTextField        = dataTextField;
     ButtonColumToAdd.DataTextFormatString = dataFormatString;
     ButtonColumToAdd.HeaderText           = headerText;
     ButtonColumToAdd.FooterText           = footerText;
     if (image)
     {
         ButtonColumToAdd.HeaderImageUrl = LocationImage;
     }
     ButtonColumToAdd.SortExpression = Sort;
     ButtonColumToAdd.Visible        = Visible;
     ButtonColumToAdd.Text           = text;
 }
    private void Form1_Load(object sender, EventArgs e)
    {
        DataGridViewTextBoxColumn t = new DataGridViewTextBoxColumn();

        t.HeaderText = "test";
        DataGridViewComboBoxColumn c = new DataGridViewComboBoxColumn();

        c.HeaderText = "formula";
        ButtonColumn   col  = new ButtonColumn();
        CalendarColumn col2 = new CalendarColumn();

        this.dataGridView1.Columns.AddRange(t, col, c, col2);
        //this.dataGridView1.RowCount = 5;
        //foreach (DataGridViewRow row in this.dataGridView1.Rows)
        //{
        //    row.Cells[0].Value = DateTime.Now;
        //}
    }
Beispiel #21
0
        void CreateColumn()
        {
            DataGridViewTextBoxColumn t = new DataGridViewTextBoxColumn();

            t.HeaderText = "参照按纽";
            t.Name       = ColumnNames.buttonColumn.ToString();

            DataGridViewComboBoxColumn c = new DataGridViewComboBoxColumn();

            c.HeaderText = "formula";

            ButtonColumn col = new ButtonColumn();

            col.HeaderText = "button";
            col.Name       = ColumnNames.accountCode.ToString();
            col.Width      = 300;


            CalendarColumn col2 = new CalendarColumn();

            this.dgvButton.Columns.AddRange(t, col, c, col2);
        }
Beispiel #22
0
        protected override void OnInit(EventArgs e)
        {
            if (Page != null)
            {
                EditCommandColumn c0 = new EditCommandColumn();
                c0.EditText   = "<img src='/i/edit.gif' border=0 alt='edit this item'>";
                c0.CancelText = "<img src='/i/cancel.gif' border=0 alt=cancel>";
                c0.UpdateText = "<img src='/i/update.gif' border=0 alt='save changes'>";
                c0.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
                c0.HeaderStyle.Width         = new Unit("35px");
                this.Columns.Add(c0);

                ButtonColumn c1 = new ButtonColumn();
                c1.CommandName = "Delete";
                c1.Text        = "<img src='/i/delete.gif' border=0 alt='delete this item'>";
                c1.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
                c1.HeaderStyle.Width         = new Unit("35px");
                this.Columns.Add(c1);

                this.ShowFooter = true;
                this.ItemStyle.VerticalAlign = VerticalAlign.Top;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            int query = 2;

            string queryStr1 = Request.Params["ItemID"];
            string ItemID    = queryStr1;

            if (queryStr1 != null)
            {
                query = Int32.Parse(queryStr1);
            }
            if (ItemID != null)
            {
                itemid = Int32.Parse(ItemID);
            }

            // Save state for use in post back
            ViewState["query"] = query;

            if (IsPostBack)
            {
                query = (int)ViewState["query"];
            }
            else
            {
            }
            asub.HRef = "SubItem.aspx?id=" + itemid;
            string connStr = ConfigurationSettings.AppSettings["ConnectionString"];
            string sql;
            string qryTitle;

            ButtonColumn bcDone;
            ButtonColumn bcEdit;
            ButtonColumn bcDelete;
            ButtonColumn bcReopen;
            BoundColumn  bcOpened;
            BoundColumn  bcClosed;

            switch (query)
            {
            case 0:
                qryTitle = "All Items";
                sql      = "select * from ChildItems where ItemID = " + itemid + "  order by priority desc";

                bcOpened            = new BoundColumn();
                bcOpened.HeaderText = "Opened";
                bcOpened.DataField  = "Opened";
                ToDoDataGrid.Columns.Add(bcOpened);
                break;

            case 1:
                qryTitle = "All Closed Items";
                sql      = "SELECT * FROM ChildItems where ItemID = " + itemid + " AND Closed Is Not Null order by priority desc";

                bcClosed            = new BoundColumn();
                bcClosed.HeaderText = "Closed";
                bcClosed.DataField  = "Closed";
                ToDoDataGrid.Columns.Add(bcClosed);

                bcReopen             = new ButtonColumn();
                bcReopen.Text        = "Reopen";
                bcReopen.CommandName = "ReopenToDo";
                ToDoDataGrid.Columns.Add(bcReopen);

                bcDelete             = new ButtonColumn();
                bcDelete.Text        = "Delete";
                bcDelete.CommandName = "DeleteToDo";
                ToDoDataGrid.Columns.Add(bcDelete);
                break;

            default:
            case 2:
                qryTitle = "All Open Items";
                sql      = "SELECT * FROM ChildItems WHERE ItemID = " + itemid + " AND  Closed Is Null order by priority desc";

                bcDone             = new ButtonColumn();
                bcDone.Text        = "Done";
                bcDone.CommandName = "DoneToDo";
                ToDoDataGrid.Columns.Add(bcDone);

                bcEdit             = new ButtonColumn();
                bcEdit.Text        = "Edit";
                bcEdit.CommandName = "EditToDo";
                ToDoDataGrid.Columns.Add(bcEdit);

                bcDelete             = new ButtonColumn();
                bcDelete.Text        = "Delete";
                bcDelete.CommandName = "DeleteToDo";
                ToDoDataGrid.Columns.Add(bcDelete);
                break;
            }

            _title = "To Do List - " + qryTitle;

            SqlConnection dbconn = new SqlConnection(connStr);


            dbconn.Open();
            //SqlCommand cmd = new SqlCommand(Sql, dbconn);
            SqlDataAdapter adapter = new SqlDataAdapter(sql, connStr);

            DataSet ds = new DataSet();

            adapter.Fill(ds);
            ToDoDataGrid.DataSource = ds;
            ToDoDataGrid.DataBind();
            if (itemid != null)
            {
                string         queryStr = "select * from Items where id=" + itemid;
                SqlDataAdapter adapter1 = new SqlDataAdapter(queryStr, connStr);

                DataSet ds1 = new DataSet();

                adapter1.Fill(ds1);

                DataTable tbl = ds1.Tables[0];

                if (tbl.Rows.Count > 0)
                {
                    DataRow row = tbl.Rows[0];

                    lblDescription.Text = row["Description"].ToString();
                }
            }
        }
Beispiel #24
0
        private void DoGroup()
        {
            Table table = this.table;       // The Table control on a form - already initialised

            //table.Font = new Font(table.Font.FontFamily, 12f);
            table.SelectionStyle = SelectionStyle.Grid;
            table.BeginUpdate();
            table.EnableWordWrap         = true; // If false, then Cell.WordWrap is ignored
            table.FamilyRowSelect        = true;
            table.FullRowSelect          = true;
            table.ShowSelectionRectangle = false;
            table.MultiSelect            = true;

            table.GridLines = GridLines.Both;

            GroupColumn col0 = new GroupColumn("", 20); // this is the NEW +/- column

            col0.Editable            = false;           // Double clicking on this is to toggle the collapsed state
            col0.Selectable          = false;
            col0.ToggleOnSingleClick = true;
            ImageColumn    col1 = new ImageColumn("", 20);
            TextColumn     col2 = new TextColumn("From", 200);
            DateTimeColumn col3 = new DateTimeColumn("Sent", 180); /// 493

            col3.ShowDropDownButton   = false;
            col3.DateTimeFormat       = DateTimePickerFormat.Custom;
            col3.CustomDateTimeFormat = "d/M/yyyy hh:mm";
            col3.Alignment            = ColumnAlignment.Right;
            col3.AutoResizeMode       = ColumnAutoResizeMode.Any;
            //NumberColumn col4 = new NumberColumn("num", 60);
            //col4.ShowUpDownButtons = true;
            ButtonColumn col4 = new ButtonColumn("butt");

            col4.FlatStyle = true;

            table.ColumnModel = new ColumnModel(new Column[] { col0, col1, col2, col3, col4 });

            TableModel model = new TableModel();

            //model.RowHeight = 24;

            AddEmailRows(model, true, "Dave ", "4/9/2007 12:34", "Here is the email subject", "Here is a preview of the text that is in the email. It wraps over too so you can see more of it");

            AddEmailRows(model, false, "Richard Richard Richard Richard Richard Richard Richard Richard Richard Richard Richard Richard Richard Richard", "5/4/2007 9:13", "An email abut something", "Another preview of another ficticious email. Not much to say really");

            AddEmailRows(model, true, "Andy", "13/2/2007 9:45", "Work stuff", "Can you get this finished by this afternoon please? Thanks");

            // Make and add the context menu:
            ContextMenu menu   = new ContextMenu();
            MenuItem    delete = new MenuItem("Delete");

            delete.Click += new EventHandler(delete_Click);
            menu.MenuItems.Add(delete);
            table.ContextMenu = menu;

            // Add an event handler for the key event
            table.CellKeyUp         += new CellKeyEventHandler(table_CellKeyUp);
            table.CellButtonClicked += new CellButtonEventHandler(table_CellButtonClicked);

            table.CellMouseDown += new CellMouseEventHandler(table_CellMouseDown);
            table.CellMouseUp   += new CellMouseEventHandler(table_CellMouseUp);

            this.table.TableModel = model;

            this.table.EndUpdate();

            return;

            #region Tracer stuff
            //_tracer = new Tracer(table, OnEventTrace);
            //_tracer.HookEvent("BeginEditing");
            //_tracer.HookEvent("CellClick");
            //_tracer.HookEvent("CellDoubleClick");
            //_tracer.HookEvent("CellMouseDown");
            //_tracer.HookEvent("CellMouseEnter");
            //_tracer.HookEvent("CellMouseHover");
            //_tracer.HookEvent("CellMouseLeave");
            //_tracer.HookEvent("CellMouseMove");
            //_tracer.HookEvent("CellMouseUp");
            //_tracer.HookEvent("CellPropertyChanged");
            //_tracer.HookEvent("Click");
            //_tracer.HookEvent("DoubleClick");
            //_tracer.HookEvent("EditingStopped");
            //_tracer.HookEvent("Enter");
            //_tracer.HookEvent("GotFocus");
            //_tracer.HookEvent("LostFocus");
            //_tracer.HookEvent("MouseCaptureChanged");
            //_tracer.HookEvent("MouseClick");
            //_tracer.HookEvent("MouseDoubleClick");
            //_tracer.HookEvent("MouseDown");
            //_tracer.HookEvent("MouseEnter");
            //_tracer.HookEvent("MouseHover");
            //_tracer.HookEvent("MouseLeave");
            //_tracer.HookEvent("MouseUp");
            //            _tracer.HookAllEvents();
            #endregion
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                //程序模块权限验证
                Authorization clsRighter = new Authorization("0609");
                btnAdd.Enabled = clsRighter.Modify | clsRighter.Add;
                if (clsRighter.Read)
                {
                    //创建操作员记录数据表类实例
                    QuestionOperate question = new QuestionOperate();
                    //获取记录数据
                    DataTable dt = question.ShowQuestion();
                    DataRow   df = dt.NewRow();
                    df["UserName"] = "******";
                    dt.Rows.InsertAt(df, 0);
                    ddlQues.DataSource     = dt;
                    ddlQues.DataTextField  = "UserName";
                    ddlQues.DataValueField = "UserId";
                    ddlQues.DataBind();

                    //控制前台的“编辑”“回复”的显示方式
                    //DBManager db = DBManager.Instance();//通用数据操作类
                    //string sql = db.GetValue("select GroupId from Sys_User where UserId='" + Session["UserID"].ToString() + "'").ToString();
                    //int count = int.Parse(sql);
                    ButtonColumn      sel  = (ButtonColumn)GoodsDataGrid.Columns[8];
                    EditCommandColumn edit = (EditCommandColumn)GoodsDataGrid.Columns[6];
                    if (Session["UserGroupID"].ToString() != "2" && Session["UserGroupID"].ToString() != "3")
                    {
                        sel.Visible         = true;
                        edit.Visible        = false;
                        this.btnAdd.Visible = false;
                    }
                    else
                    {
                        sel.Visible           = false;
                        edit.Visible          = true;
                        this.btnAdd.Visible   = true;
                        ddlQues.SelectedValue = Session["UserID"].ToString();
                        ddlQues.Enabled       = false;
                    }

                    BindDataGrid();


                    int icount = this.GoodsDataGrid.Columns.Count;
                    if (!clsRighter.Add)
                    {
                        this.btnAdd.Visible = false;
                    }
                    //if (!clsRighter.Modify)
                    //{
                    //    this.GoodsDataGrid.Columns[icount - 2].Visible = false;
                    //}
                    if (!clsRighter.Delete)
                    {
                        this.GoodsDataGrid.Columns[icount - 2].Visible = false;
                    }
                }
            }
        }
        protected override void CreateChildControls()
        {
            Controls.Add(new LiteralControl("<p>"));

            ErrorMessage           = new Label();
            ErrorMessage.ForeColor = Color.Red;
            Controls.Add(ErrorMessage);

            Controls.Add(new LiteralControl("</p>"));

            DataGrid1 = new DataGrid();
            DataGrid1.EditItemStyle.BackColor = Color.WhiteSmoke;
            DataGrid1.HeaderStyle.BackColor   = Color.FromArgb(148, 175, 192);
            DataGrid1.HeaderStyle.Font.Bold   = true;
            DataGrid1.CellPadding             = 5;
            DataGrid1.BorderWidth             = 1;
            DataGrid1.BorderColor             = Color.LightGray;
            DataGrid1.Width = 600;
            DataGrid1.AutoGenerateColumns = false;
            DataGrid1.ItemCommand        += new DataGridCommandEventHandler(DataGrid1_Command);
            TemplateColumn c1 = new TemplateColumn();

            c1.HeaderTemplate          = new CheckColumnTemplate(ListItemType.Header);
            c1.HeaderStyle.Width       = 21;
            c1.ItemTemplate            = new CheckColumnTemplate(ListItemType.Item);
            c1.ItemStyle.VerticalAlign = VerticalAlign.Top;
            c1.Visible = false;
            DataGrid1.Columns.Add(c1);

            TemplateColumn c2 = new TemplateColumn();

            DataGrid1.Columns.Add(c2);
            DataGrid1.ItemCreated   += new DataGridItemEventHandler(DataGrid1_ItemCreated);
            DataGrid1.EditCommand   += new DataGridCommandEventHandler(DataGrid1_EditCommand);
            DataGrid1.CancelCommand += new DataGridCommandEventHandler(DataGrid1_CancelCommand);
            DataGrid1.UpdateCommand += new DataGridCommandEventHandler(DataGrid1_UpdateCommand);

            ButtonColumn c3 = new ButtonColumn();

            c3.ButtonType        = ButtonColumnType.PushButton;
            c3.HeaderStyle.Width = 5;
            c3.ItemStyle.Width   = 5;
            c3.HeaderText        = "Shift Up";
            c3.CommandName       = "UpClick";
            c3.Text    = "\u2191";
            c3.Visible = false;
            DataGrid1.Columns.Add(c3);

            ButtonColumn c4 = new ButtonColumn();

            c4.ButtonType                = ButtonColumnType.PushButton;
            c4.ItemStyle.Width           = 5;
            c4.HeaderStyle.Width         = 5;
            c4.HeaderText                = "Shift Down";
            c4.CommandName               = "DownClick";
            c4.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
            c4.Text    = "\u2193";
            c4.Visible = false;
            DataGrid1.Columns.Add(c4);

            ButtonColumn c5 = new ButtonColumn();

            c5.ButtonType      = ButtonColumnType.PushButton;
            c5.ItemStyle.Width = 25;
            c5.CommandName     = "Delete";
            c5.HeaderText      = "Delete";
            c5.Text            = "Delete";
            c5.Visible         = false;
            DataGrid1.Columns.Add(c5);

            Controls.Add(DataGrid1);

            Controls.Add(new LiteralControl("<p>"));

            NewButton                  = new Button();
            NewButton.ID               = "NewButton";
            NewButton.CssClass         = "defaultButton";
            NewButton.Text             = "New";
            NewButton.CausesValidation = false;
            NewButton.Click           += new EventHandler(NewButton_Click);
            Controls.Add(NewButton);

            Controls.Add(new LiteralControl("&nbsp;"));

            DeleteButton                  = new Button();
            DeleteButton.ID               = "DeleteButton";
            DeleteButton.CssClass         = "defaultButton";
            DeleteButton.Text             = "Delete";
            DeleteButton.Enabled          = false;
            DeleteButton.CausesValidation = false;
            DeleteButton.Click           += new EventHandler(DeleteButton_Click);
            //Controls.Add( DeleteButton );

            Controls.Add(new LiteralControl("&nbsp;"));

            UpButton                  = new Button();
            UpButton.ID               = "UpButton";
            UpButton.CssClass         = "defaultButton";
            UpButton.Text             = "Up";
            UpButton.Enabled          = false;
            UpButton.CausesValidation = false;
            UpButton.CommandName      = "MoveUp";
            UpButton.Command         += new CommandEventHandler(OnMoveCommand);
            //Controls.Add( UpButton );

            Controls.Add(new LiteralControl("&nbsp;"));

            DownButton                  = new Button();
            DownButton.ID               = "DownButton";
            DownButton.CssClass         = "defaultButton";
            DownButton.Text             = "Down";
            DownButton.Enabled          = false;
            DownButton.CausesValidation = false;
            DownButton.CommandName      = "MoveDown";
            DownButton.Command         += new CommandEventHandler(OnMoveCommand);
            //Controls.Add( DownButton );

            Controls.Add(new LiteralControl("</p>"));
        }
Beispiel #27
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            int query = 2;

            if (IsPostBack)
            {
                query = (int)ViewState["query"];
            }
            else
            {
                string queryStr = Request.Params["query"];

                if (queryStr != null)
                {
                    query = Int32.Parse(queryStr);
                }

                // Save state for use in post back
                ViewState["query"] = query;
            }

            string connStr = ConfigurationSettings.AppSettings["ConnectionString"];
            string sql;
            string qryTitle;

            ButtonColumn bcDone;
            ButtonColumn bcEdit;
            ButtonColumn bcDelete;
            ButtonColumn bcReopen;
            BoundColumn  bcOpened;
            BoundColumn  bcClosed;

            switch (query)
            {
            case 0:
                qryTitle = "All Items";
                sql      = "select ID, Description, Opened, Closed, Priority,FORMAT(EndDate,'dd/MM/yyyy') as EndDate from items order by priority desc";

                bcOpened            = new BoundColumn();
                bcOpened.HeaderText = "Opened";
                bcOpened.DataField  = "Opened";
                ToDoDataGrid.Columns.Add(bcOpened);
                break;

            case 1:
                qryTitle = "All Closed Items";
                sql      = "select ID, Description, Opened, Closed, Priority,FORMAT(EndDate,'dd/MM/yyyy') as EndDate from items WHERE Closed Is Not Null order by priority desc";

                bcClosed            = new BoundColumn();
                bcClosed.HeaderText = "Closed";
                bcClosed.DataField  = "Closed";
                ToDoDataGrid.Columns.Add(bcClosed);

                bcReopen             = new ButtonColumn();
                bcReopen.Text        = "Reopen";
                bcReopen.CommandName = "ReopenToDo";
                ToDoDataGrid.Columns.Add(bcReopen);

                bcDelete             = new ButtonColumn();
                bcDelete.Text        = "Delete";
                bcDelete.CommandName = "DeleteToDo";
                ToDoDataGrid.Columns.Add(bcDelete);
                break;

            default:
            case 2:
                qryTitle = "All Open Items";
                sql      = "select ID, Description, Opened, Closed, Priority,FORMAT(EndDate,'dd/MM/yyyy') as EndDate from items WHERE Closed Is Null order by priority desc";

                bcDone             = new ButtonColumn();
                bcDone.Text        = "Done";
                bcDone.CommandName = "DoneToDo";
                ToDoDataGrid.Columns.Add(bcDone);

                bcEdit             = new ButtonColumn();
                bcEdit.Text        = "Edit";
                bcEdit.CommandName = "EditToDo";
                ToDoDataGrid.Columns.Add(bcEdit);

                bcDelete             = new ButtonColumn();
                bcDelete.Text        = "Delete";
                bcDelete.CommandName = "DeleteToDo";
                ToDoDataGrid.Columns.Add(bcDelete);
                break;
            }

            _title = "To Do List - " + qryTitle;

            SqlConnection dbconn = new SqlConnection(connStr);


            dbconn.Open();
            //SqlCommand cmd = new SqlCommand(Sql, dbconn);
            SqlDataAdapter adapter = new SqlDataAdapter(sql, connStr);

            DataSet ds = new DataSet();

            adapter.Fill(ds);
            ToDoDataGrid.DataSource = ds;
            ToDoDataGrid.DataBind();
        }
Beispiel #28
0
        /// <summary>
        /// OnInit() method -- Add the Edit and Delete columns to the grid
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"></see> that contains the event data.</param>
        protected override void OnInit(EventArgs e)
        {
            // Test for Page to ensure this doesn't run at design time
            if (Page != null)
            {
                string imagePath = GetClientScriptPath();

                EditCommandColumn c0 = new EditCommandColumn();
                c0.EditText = "<img src='" + imagePath + "edit.gif' border=0 alt='" +General.GetString("XMLEDITGRID_EDITITEM", "edit this item") + "'>";
                c0.CancelText = "<img src='" + imagePath + "cancel.gif' border=0 alt='" +General.GetString("XMLEDITGRID_CANCEL", "cancel") + "'>";
                c0.UpdateText = "<img src='" + imagePath + "update.gif' border=0 alt='" +General.GetString("XMLEDITGRID_SAVE", "save changes") + "'>";
                c0.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
                c0.HeaderStyle.Width = new Unit("35px");
                this.Columns.Add(c0);

                ButtonColumn c1 = new ButtonColumn();
                c1.CommandName = "Delete";
                c1.Text = "<img src='" + imagePath + "delete.gif' border=0 alt='" +General.GetString("XMLEDITGRID_DELETE", "delete this item") + "'>";
                c1.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
                c1.HeaderStyle.Width = new Unit("35px");
                this.Columns.Add(c1);

                this.ShowFooter = true;
                this.ItemStyle.VerticalAlign = VerticalAlign.Top;
            }
        }
Beispiel #29
0
        private void Page_Load(object sender, EventArgs e)
        {
            HtmlForm form1 = (HtmlForm)this.FindControl("Form1");

            this.GHTTestBegin(form1);
            base.GHTActiveSubTest = this.GHTSubTest1;
            try
            {
                this.DataGrid1.DataSource = GHDataSources.DSDataTable();
                ButtonColumn column2 = new ButtonColumn();
                ButtonColumn column3 = new ButtonColumn();
                ButtonColumn column1 = new ButtonColumn();
                column2.DataTextField        = "ID";
                column3.DataTextField        = "Name";
                column1.DataTextField        = "Company";
                column2.DataTextFormatString = "";
                column3.DataTextFormatString = "(format str)";
                column1.DataTextFormatString = "{0:c5}";
                this.DataGrid1.Columns.Add(column2);
                this.DataGrid1.Columns.Add(column3);
                this.DataGrid1.Columns.Add(column1);
                this.DataGrid1.DataBind();
                this.GHTSubTestAddResult(column2.DataTextFormatString);
                this.GHTSubTestAddResult(column3.DataTextFormatString);
                this.GHTSubTestAddResult(column1.DataTextFormatString);
            }
            catch (Exception exception5)
            {
                // ProjectData.SetProjectError(exception5);
                Exception exception1 = exception5;
                this.GHTSubTestUnexpectedExceptionCaught(exception1);
                // ProjectData.ClearProjectError();
            }
            base.GHTActiveSubTest = this.Ghtsubtest2;
            try
            {
                this.DataGrid2.DataSource = GHDataSources.DSDataTable();
                ButtonColumn column4 = new ButtonColumn();
                ButtonColumn column5 = new ButtonColumn();
                ButtonColumn column6 = new ButtonColumn();
                column4.DataTextField        = "ID";
                column5.DataTextField        = "ID";
                column6.DataTextField        = "ID";
                column4.DataTextFormatString = "";
                column5.DataTextFormatString = "(format str)";
                column6.DataTextFormatString = "{0:c5}";
                this.DataGrid2.Columns.Add(column4);
                this.DataGrid2.Columns.Add(column5);
                this.DataGrid2.Columns.Add(column6);
                this.DataGrid2.DataBind();
                this.GHTSubTestAddResult(column4.DataTextFormatString);
                this.GHTSubTestAddResult(column5.DataTextFormatString);
                this.GHTSubTestAddResult(column6.DataTextFormatString);
            }
            catch (Exception exception6)
            {
                // ProjectData.SetProjectError(exception6);
                Exception exception2 = exception6;
                this.GHTSubTestUnexpectedExceptionCaught(exception2);
                // ProjectData.ClearProjectError();
            }
            base.GHTActiveSubTest = this.Ghtsubtest3;
            try
            {
                this.DataGrid3.DataSource = GHDataSources.DSDataTable();
                this.DataGrid3.DataBind();
                this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid3.Columns[0]).DataTextFormatString);
                this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid3.Columns[1]).DataTextFormatString);
                this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid3.Columns[2]).DataTextFormatString);
            }
            catch (Exception exception7)
            {
                // ProjectData.SetProjectError(exception7);
                Exception exception3 = exception7;
                this.GHTSubTestUnexpectedExceptionCaught(exception3);
                // ProjectData.ClearProjectError();
            }
            base.GHTActiveSubTest = this.Ghtsubtest4;
            try
            {
                this.DataGrid4.DataSource = GHDataSources.DSDataTable();
                this.DataGrid4.DataBind();
                this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid4.Columns[0]).DataTextFormatString);
                this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid4.Columns[1]).DataTextFormatString);
                this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid4.Columns[2]).DataTextFormatString);
            }
            catch (Exception exception8)
            {
                // ProjectData.SetProjectError(exception8);
                Exception exception4 = exception8;
                this.GHTSubTestUnexpectedExceptionCaught(exception4);
                // ProjectData.ClearProjectError();
            }
            this.GHTTestEnd();
        }
Beispiel #30
0
      private void Page_Load(object sender, EventArgs e)
      {
          HtmlForm form1 = (HtmlForm)this.FindControl("Form1");

          this.GHTTestBegin(form1);
          base.GHTActiveSubTest = this.GHTSubTest1;
          try
          {
              this.DataGrid1.DataSource = GHTTests.GHDataSources.DSDataTable();
              ButtonColumn column2 = new ButtonColumn();
              ButtonColumn column3 = new ButtonColumn();
              ButtonColumn column1 = new ButtonColumn();
              column2.DataTextField = "ID";
              column3.DataTextField = "Name";
              column1.DataTextField = "Company";
              this.DataGrid1.Columns.Add(column2);
              this.DataGrid1.Columns.Add(column3);
              this.DataGrid1.Columns.Add(column1);
              this.DataGrid1.DataBind();
              this.GHTSubTestAddResult(column2.ButtonType.ToString());
              this.GHTSubTestAddResult(column3.ButtonType.ToString());
              this.GHTSubTestAddResult(column1.ButtonType.ToString());
          }
          catch (Exception exception7)
          {
              // ProjectData.SetProjectError(exception7);
              Exception exception1 = exception7;
              this.GHTSubTestUnexpectedExceptionCaught(exception1);
              // ProjectData.ClearProjectError();
          }
          base.GHTActiveSubTest = this.Ghtsubtest2;
          try
          {
              this.DataGrid2.DataSource = GHTTests.GHDataSources.DSDataTable();
              ButtonColumn column5 = new ButtonColumn();
              ButtonColumn column6 = new ButtonColumn();
              ButtonColumn column4 = new ButtonColumn();
              column5.DataTextField = "ID";
              column6.DataTextField = "Name";
              column4.DataTextField = "Company";
              column5.ButtonType    = ButtonColumnType.LinkButton;
              column6.ButtonType    = ButtonColumnType.LinkButton;
              column4.ButtonType    = ButtonColumnType.LinkButton;
              this.DataGrid2.Columns.Add(column5);
              this.DataGrid2.Columns.Add(column6);
              this.DataGrid2.Columns.Add(column4);
              this.DataGrid2.DataBind();
              this.GHTSubTestAddResult(column5.ButtonType.ToString());
              this.GHTSubTestAddResult(column6.ButtonType.ToString());
              this.GHTSubTestAddResult(column4.ButtonType.ToString());
          }
          catch (Exception exception8)
          {
              // ProjectData.SetProjectError(exception8);
              Exception exception2 = exception8;
              this.GHTSubTestUnexpectedExceptionCaught(exception2);
              // ProjectData.ClearProjectError();
          }
          base.GHTActiveSubTest = this.Ghtsubtest3;
          try
          {
              this.DataGrid3.DataSource = GHTTests.GHDataSources.DSDataTable();
              ButtonColumn column8 = new ButtonColumn();
              ButtonColumn column9 = new ButtonColumn();
              ButtonColumn column7 = new ButtonColumn();
              column8.DataTextField = "ID";
              column9.DataTextField = "Name";
              column7.DataTextField = "Company";
              column8.ButtonType    = ButtonColumnType.PushButton;
              column9.ButtonType    = ButtonColumnType.PushButton;
              column7.ButtonType    = ButtonColumnType.PushButton;
              this.DataGrid3.Columns.Add(column8);
              this.DataGrid3.Columns.Add(column9);
              this.DataGrid3.Columns.Add(column7);
              this.DataGrid3.DataBind();
              this.GHTSubTestAddResult(column8.ButtonType.ToString());
              this.GHTSubTestAddResult(column9.ButtonType.ToString());
              this.GHTSubTestAddResult(column7.ButtonType.ToString());
          }
          catch (Exception exception9)
          {
              // ProjectData.SetProjectError(exception9);
              Exception exception3 = exception9;
              this.GHTSubTestUnexpectedExceptionCaught(exception3);
              // ProjectData.ClearProjectError();
          }
          base.GHTActiveSubTest = this.Ghtsubtest4;
          try
          {
              this.DataGrid4.DataSource = GHTTests.GHDataSources.DSDataTable();
              this.DataGrid4.DataBind();
              this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid4.Columns[0]).ButtonType.ToString());
              this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid4.Columns[1]).ButtonType.ToString());
              this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid4.Columns[2]).ButtonType.ToString());
          }
          catch (Exception exception10)
          {
              // ProjectData.SetProjectError(exception10);
              Exception exception4 = exception10;
              this.GHTSubTestUnexpectedExceptionCaught(exception4);
              // ProjectData.ClearProjectError();
          }
          base.GHTActiveSubTest = this.Ghtsubtest5;
          try
          {
              this.DataGrid5.DataSource = GHTTests.GHDataSources.DSDataTable();
              this.DataGrid5.DataBind();
              this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid5.Columns[0]).ButtonType.ToString());
              this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid5.Columns[1]).ButtonType.ToString());
              this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid5.Columns[2]).ButtonType.ToString());
          }
          catch (Exception exception11)
          {
              // ProjectData.SetProjectError(exception11);
              Exception exception5 = exception11;
              this.GHTSubTestUnexpectedExceptionCaught(exception5);
              // ProjectData.ClearProjectError();
          }
          base.GHTActiveSubTest = this.Ghtsubtest6;
          try
          {
              this.DataGrid6.DataSource = GHTTests.GHDataSources.DSDataTable();
              this.DataGrid6.DataBind();
              this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid6.Columns[0]).ButtonType.ToString());
              this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid6.Columns[1]).ButtonType.ToString());
              this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid6.Columns[2]).ButtonType.ToString());
          }
          catch (Exception exception12)
          {
              // ProjectData.SetProjectError(exception12);
              Exception exception6 = exception12;
              this.GHTSubTestUnexpectedExceptionCaught(exception6);
              // ProjectData.ClearProjectError();
          }
          this.GHTTestEnd();
      }
Beispiel #31
0
    public void Page_Load(object sender, EventArgs e)
    {
        nfi.NumberDecimalSeparator = ".";
        string constr = Global.connstr;

        //String spojeni = ConfigurationSettings.AppSettings[0]; //mozne nastaveni ve web.config
        dt1  = new DataTable();
        dt2  = new DataTable();
        conn = new SqlConnection(constr);
        conn.Open();

        using (var comm = conn.CreateCommand())
        {
            SelectTable(comm);
        }

        dt1.Columns["Id"].ReadOnly = true;
        dtv1 = new DataView(dt1);
        dtv2 = new DataView(dt2);


        Button but = new Button();

        but.Text = "Pridat radek";
        but.ID   = "BUTTON1";
        //Button1 = FindControl("BUTTON1") as Button;
        //Button1.Click += Button1_Click;
        but.Click += Button1_Click;


        EditCommandColumn edcol = new EditCommandColumn();

        edcol.EditText         = "Oprava";
        edcol.CancelText       = "Unik";
        edcol.UpdateText       = "Ulozeni";
        edcol.ItemStyle.Wrap   = false;
        edcol.HeaderStyle.Wrap = false;
        ButtonColumn butcol = new ButtonColumn();

        butcol.ButtonType  = ButtonColumnType.LinkButton;
        butcol.Text        = "Smazat";
        butcol.CommandName = "Delete";


        DataGrid1 = FindControl("DataGrid11") as DataGrid;
        DataGrid1.Columns.Add(edcol);
        DataGrid1.Columns.Add(butcol);
        Form.Controls.Add(but);

        DataGrid1.EditCommand +=
            new DataGridCommandEventHandler(this.ItemsGrid_Edit);
        DataGrid1.CancelCommand +=
            new DataGridCommandEventHandler(this.ItemsGrid_Cancel);
        DataGrid1.UpdateCommand +=
            new DataGridCommandEventHandler(this.ItemsGrid_Update);
        DataGrid1.ItemCommand +=
            new DataGridCommandEventHandler(this.ItemsGrid_Command);
        DataGrid1.AllowSorting = true;


        DataGrid1.DataSource = dt1;
        DataGrid1.DataBind();


        //DataGrid2 = FindControl("DataGrid22") as DataGrid;
        DataGrid2             = new DataGrid();
        DataGrid2.Style.Value = "position:absolute;top:10%;left:50%";
        DataGrid1.Parent.Controls.Add(DataGrid2);
        DataGrid2.DataSource = dt2;
        DataGrid2.DataBind();
    }