Exemplo n.º 1
0
        protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            base.InitializeDataCell(cell, rowState);

            // Add a checkbox anyway, if not done already
            if (cell.Controls.Count == 0)
            {
                CheckBox chk = new CheckBox();
                chk.ID = InputCheckBoxField.CheckBoxID;
                cell.Controls.Add(chk);
            }
        }
Exemplo n.º 2
0
        public void BoundField_InitializeDataCell()
        {
            PokerBoundField bf = new PokerBoundField();

            bf.HeaderText = "headertest";
            DataControlFieldCell cell  = new DataControlFieldCell(null);
            DataControlRowState  state = DataControlRowState.Edit;

            Assert.AreEqual(0, cell.Controls.Count, "InitializeDataCellControlsBeforeInit");
            bf.DoInitializeDataCell(cell, state);
            Assert.AreEqual(1, cell.Controls.Count, "InitializeDataCellControlsAfterInit");
        }
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            //  Response.Write("Hello world");
            LinkButton           UpdataLinkButton    = (LinkButton)sender;
            DataControlFieldCell DataControlFieldCel = (DataControlFieldCell)UpdataLinkButton.Parent;
            GridViewRow          GridViewRow         = (GridViewRow)DataControlFieldCel.Parent;
            HiddenField          idHiddenField       = (HiddenField)GridViewRow.FindControl("IdHiddenField");
            int id = Convert.ToInt32(idHiddenField.Value);

            // Response.Write(id);
            Response.Redirect("UpdateStudentEntry.aspx?id=" + id);
        }
Exemplo n.º 4
0
        /// <summary>
        /// When implemented by a class, defines the <see cref="T:System.Web.UI.Control"/> object that child controls and templates belong to. These child controls are in turn defined within an inline template.
        /// </summary>
        /// <param name="container">The <see cref="T:System.Web.UI.Control"/> object to contain the instances of controls from the inline template.</param>
        public void InstantiateIn(Control container)
        {
            DataControlFieldCell cell = container as DataControlFieldCell;

            if (cell != null)
            {
                HtmlGenericControl a = new HtmlGenericControl("a");
                a.Attributes.Add("href", "#");
                a.InnerText = "Reorder";
                cell.Controls.Add(a);
            }
        }
Exemplo n.º 5
0
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (null == cell)
     {
         throw new ArgumentNullException("cell");
     }
     if (cellType == DataControlCellType.DataCell)
     {
         cell.DataBinding += new EventHandler(this.cell_DataBinding);
     }
 }
Exemplo n.º 6
0
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (cellType == DataControlCellType.DataCell)
     {
         HyperLink link = cell.Controls[0] as HyperLink;
         if (link != null)
         {
             link.Attributes.Add("onclick", "javascript:return confirm('" + this.ConfirmText + "');");
         }
     }
 }
Exemplo n.º 7
0
            /// <summary>
            /// Handles the Load event of the cell control.
            /// </summary>
            /// <param name="sender">The source of the event.</param>
            /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
            private void cell_Load(object sender, EventArgs e)
            {
                DataControlFieldCell cell = sender as DataControlFieldCell;
                var row = cell.DataItemContainer as GridViewRow;

                if (row.Page.IsPostBack)
                {
                    Panel           selectionControlContainer   = row.FindControl($"selectionControlContainer_{MergePersonField.PersonId}") as Panel;
                    RockCheckBox    selectionControlCheckbox    = selectionControlContainer.FindControl($"selectionControlCheckbox_{MergePersonField.PersonId}") as RockCheckBox;
                    RockRadioButton selectionControlRadioButton = selectionControlContainer.FindControl($"selectionControlRadioButton_{MergePersonField.PersonId}") as RockRadioButton;
                }
            }
Exemplo n.º 8
0
        /// <summary>
        /// Adds a checkbox control to a cell's controls collection
        /// </summary>
        /// <param name="cell"></param>
        /// <param name="cellType"></param>
        /// <param name="rowState"></param>
        /// <param name="rowIndex"></param>
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);

            // Add a checkbox anyway, if not done already
            if (cell.Controls.Count == 0 && cellType == DataControlCellType.DataCell)
            {
                CheckBox chk = new CheckBox();
                chk.ID = CheckBoxBoundField.CheckBoxID;
                cell.Controls.Add(chk);
            }
        }
Exemplo n.º 9
0
        void Case4(DataControlFieldCell cell)
        {
            CheckBox checkBox = new CheckBox();

            checkBox.ToolTip = "Dummy";
            cell.Controls.Add(checkBox);

            ListBox lb = new ListBox();

            lb.DataBinding += OnDataBindField;
            cell.Controls.Add(lb);
        }
Exemplo n.º 10
0
        /// <summary>
        /// When implemented by a class, defines the <see cref="T:System.Web.UI.Control" /> object that child controls and templates belong to. These child controls are in turn defined within an inline template.
        /// </summary>
        /// <param name="container">The <see cref="T:System.Web.UI.Control" /> object to contain the instances of controls from the inline template.</param>
        public void InstantiateIn(Control container)
        {
            DataControlFieldCell cell = container as DataControlFieldCell;

            if (cell != null)
            {
                this.LavaField = cell.ContainingField as LavaField;
                Literal lOutputText = new Literal();
                lOutputText.DataBinding += lOutputText_DataBinding;
                cell.Controls.Add(lOutputText);
            }
        }
Exemplo n.º 11
0
        void Case3(DataControlFieldCell cell)
        {
            Content content = new Content();

            CheckBox checkBox = new CheckBox();

            checkBox.ToolTip = "Dummy";
            content.Controls.Add(checkBox);
            checkBox.DataBinding += OnDataBindField;

            cell.Controls.Add(content);
        }
Exemplo n.º 12
0
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (cellType == DataControlCellType.DataCell)
     {
         cell.CssClass = "ms-vb-title";
         CPMenu child = new CPMenu
         {
             UseMaximumWidth = this.UseMaximumWidth,
             MenuFormat      = this.MenuFormat
         };
         if (!string.IsNullOrEmpty(this.MenuTemplateId))
         {
             child.TemplateId = this.MenuTemplateId;
         }
         if (!string.IsNullOrEmpty(this.TextCssClass))
         {
             child.TextCssClass = this.TextCssClass;
         }
         if (!string.IsNullOrEmpty(this.ImageUrlFormat) && string.IsNullOrEmpty(this.ImageUrlFields))
         {
             child.ImageUrl = this.ImageUrlFormat;
         }
         if (!string.IsNullOrEmpty(this.NavigateUrlFormat) && string.IsNullOrEmpty(this.NavigateUrlFields))
         {
             child.NavigateUrl = this.NavigateUrlFormat;
         }
         if (!string.IsNullOrEmpty(this.TextFormat) && string.IsNullOrEmpty(this.TextFields))
         {
             child.Text = this.TextFormat;
         }
         if (!string.IsNullOrEmpty(this.ToolTipFormat) && string.IsNullOrEmpty(this.ToolTipFields))
         {
             child.ToolTip = this.ToolTipFormat;
         }
         if (cell.HasControls())
         {
             // replace Microsoft.SharePoint.WebControls.Menu that was added by base method
             cell.Controls.Clear();
         }
         cell.Controls.Add(child);
         if (((rowState & DataControlRowState.Insert) == DataControlRowState.Normal) && ((!string.IsNullOrEmpty(this.TextFields) || !string.IsNullOrEmpty(this.ImageUrlFields)) || ((!string.IsNullOrEmpty(this.ToolTipFields) || !string.IsNullOrEmpty(this.NavigateUrlFields)) || !string.IsNullOrEmpty(this.TokenNameAndValueFields))))
         {
             // set DataBinding event handler to execute the handler for Microsoft.SharePoint.WebControls.Menu
             child.DataBinding += new EventHandler(delegate(object sender, EventArgs e)
             {
                 Type baseType = typeof(SPMenuField);
                 baseType.InvokeMember("DataBindingEventHandler", BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod, null, this, new[] { sender, e });
             });
         }
     }
 }
Exemplo n.º 13
0
        /// <summary>
        /// When implemented by a class, defines the <see cref="T:System.Web.UI.Control"/> object that child controls and templates belong to. These child controls are in turn defined within an inline template.
        /// </summary>
        /// <param name="container">The <see cref="T:System.Web.UI.Control"/> object to contain the instances of controls from the inline template.</param>
        public void InstantiateIn(Control container)
        {
            DataControlFieldCell cell = container as DataControlFieldCell;

            if (cell != null)
            {
                LinkButton lbEditValue = new LinkButton();
                lbEditValue.ToolTip = "Edit";
                lbEditValue.Click  += lbEditValue_Click;

                cell.Controls.Add(lbEditValue);
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// When implemented by a class, defines the <see cref="T:System.Web.UI.Control"/> object that child controls and templates belong to. These child controls are in turn defined within an inline template.
        /// </summary>
        /// <param name="container">The <see cref="T:System.Web.UI.Control"/> object to contain the instances of controls from the inline template.</param>
        public void InstantiateIn(Control container)
        {
            DataControlFieldCell cell = container as DataControlFieldCell;

            if (cell != null)
            {
                LinkButton lbDelete = new LinkButton();
                lbDelete.Text   = "Delete";
                lbDelete.Click += lbDelete_Click;

                cell.Controls.Add(lbDelete);
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// When implemented by a class, defines the <see cref="T:System.Web.UI.Control"/> object that child controls and templates belong to. These child controls are in turn defined within an inline template.
        /// </summary>
        /// <param name="container">The <see cref="T:System.Web.UI.Control"/> object to contain the instances of controls from the inline template.</param>
        public void InstantiateIn(Control container)
        {
            DataControlFieldCell cell = container as DataControlFieldCell;

            if (cell != null)
            {
                LinkButton lbEdit = new LinkButton();
                lbEdit.Text   = "Edit";
                lbEdit.Click += lbEdit_Click;

                cell.Controls.Add(lbEdit);
            }
        }
        public void TemplateField_InitializeCell()
        {
            PokerTemplateField   field = new PokerTemplateField();
            DataControlFieldCell cell  = new DataControlFieldCell(null);

            field.InitializeCell(cell, DataControlCellType.DataCell, DataControlRowState.Normal, 0);
            Assert.AreEqual("&nbsp;", cell.Text, "InitializeCellEmpty");
            field.ItemTemplate = new IImage("test");
            field.InitializeCell(cell, DataControlCellType.DataCell, DataControlRowState.Normal, 0);
            Assert.AreEqual("", cell.Text, "InitializeCellWithItemTemplate");
            Assert.AreEqual(1, cell.Controls.Count, "InitializeCellWithItemTemplate#1");
            Assert.AreEqual("test", ((IImage)cell.Controls [0]).ImageUrl, "InitializeCellWithItemTemplate#2");
        }
Exemplo n.º 17
0
        protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            base.InitializeDataCell(cell, rowState);

            if (cell != null && cell.Controls.Count > 0)
            {
                var textBox = cell.Controls[0] as TextBox;
                if (textBox != null)
                {
                    textBox.TextMode = TextBoxMode.MultiLine;
                }
            }
        }
Exemplo n.º 18
0
        void cell_PreRender(object sender, EventArgs e)
        {
            DataControlFieldCell cell = (DataControlFieldCell)sender;
            GridViewRow          row  = (GridViewRow)cell.NamingContainer;
            int seq = row.RowIndex + 1;

            if (this.UsePageIndex)
            {
                GridView gv = (GridView)row.NamingContainer;
                seq += gv.PageIndex * gv.PageSize;
            }
            cell.Text = string.Format("{0:N0}", seq);
        }
Exemplo n.º 19
0
    }//string

    public static string ExtraeValorCelda(int valorCelda, string nombreCampo, GridViewDeleteEventArgs e, GridView gridview)
    {
        DataControlFieldCell cell = (DataControlFieldCell)gridview.Rows[e.RowIndex].Cells[valorCelda];
        BoundField field = (BoundField)cell.ContainingField;
        System.Collections.Specialized.OrderedDictionary dict = new System.Collections.Specialized.OrderedDictionary();
        field.ExtractValuesFromCell(dict, cell, DataControlRowState.Edit, true);

        if (dict[nombreCampo] == null)
            return string.Empty;
        else
            return dict[nombreCampo].ToString().Replace("$", "").Trim();

    }//string
Exemplo n.º 20
0
        /// <summary>
        /// Adds text or controls to a cell's control collection.
        /// </summary>
        /// <param name="cell"></param>
        /// <param name="cellType"></param>
        /// <param name="rowState"></param>
        /// <param name="rowIndex"></param>
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);

            if (cellType == DataControlCellType.DataCell)
            {
                this.InitializeDataCell(cell);
            }
            else if (cellType == DataControlCellType.Header)
            {
                this.InitializeHeader(cell);
            }
        }
Exemplo n.º 21
0
 protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
 {
     if ((rowState & DataControlRowState.Edit) != DataControlRowState.Normal)
     {
         TextBox textBox = new TextBox();
         cell.Controls.Add(textBox);
         textBox.DataBinding += OnDataBindField;
     }
     else
     {
         base.InitializeDataCell(cell, rowState);
     }
 }
Exemplo n.º 22
0
 /// <summary>
 /// Overridden. Initializes a cell in a HyperLinkField object.
 /// </summary>
 /// <param name="cell"></param>
 /// <param name="cellType"></param>
 /// <param name="rowState"></param>
 /// <param name="rowIndex"></param>
 public override void InitializeCell(DataControlFieldCell cell,
                                     DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (cellType == DataControlCellType.DataCell)
     {
         InitializeDataCell(cell, rowState);
         if ((rowState & DataControlRowState.Insert) == 0)
         {
             cell.DataBinding += new EventHandler(OnDataBindField);
         }
     }
 }
Exemplo n.º 23
0
        /// <summary>
        /// Adds text or controls to a cell's controls collection.
        /// </summary>
        /// <param name="cell">A <see cref="T:System.Web.UI.WebControls.DataControlFieldCell" /> that contains the text or controls of the <see cref="T:System.Web.UI.WebControls.DataControlField" />.</param>
        /// <param name="cellType">One of the <see cref="T:System.Web.UI.WebControls.DataControlCellType" /> values.</param>
        /// <param name="rowState">One of the <see cref="T:System.Web.UI.WebControls.DataControlRowState" /> values, specifying the state of the row that contains the <see cref="T:System.Web.UI.WebControls.DataControlFieldCell" />.</param>
        /// <param name="rowIndex">The index of the row that the <see cref="T:System.Web.UI.WebControls.DataControlFieldCell" /> is contained in.</param>
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            if (cellType == DataControlCellType.Header)
            {
                if (!string.IsNullOrEmpty(this.HeaderStyle.CssClass))
                {
                    // make sure the header cell sets the CssClass
                    cell.AddCssClass(this.HeaderStyle.CssClass);
                }
            }

            base.InitializeCell(cell, cellType, rowState, rowIndex);
        }
Exemplo n.º 24
0
        protected void vehicleDetailsView_ItemCommand(object sender, DetailsViewCommandEventArgs e)
        {
            if (e.CommandName == "Cancel")
            {
                // retrieve value from DetailsView with "Dictionary" -> IOrderedDictionary
                IOrderedDictionary   valuesDictionary = new OrderedDictionary();
                DataControlFieldCell vMakeCell        = (DataControlFieldCell)vehicleDetailsView.Rows[4].Cells[1];
                vMakeCell.ContainingField.ExtractValuesFromCell(valuesDictionary, vMakeCell, DataControlRowState.Edit, true);
                // vMakeCell.ContainingField.ExtractValuesFromCell(values, cell, row.RowState, true);

                //string make1 = valuesDictionary["year"].ToString();
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// When implemented by a class, defines the <see cref="T:System.Web.UI.Control"/> object that child controls and templates belong to. These child controls are in turn defined within an inline template.
        /// </summary>
        /// <param name="container">The <see cref="T:System.Web.UI.Control"/> object to contain the instances of controls from the inline template.</param>
        public void InstantiateIn(Control container)
        {
            DataControlFieldCell cell = container as DataControlFieldCell;

            if (cell != null)
            {
                HtmlGenericControl aSecure = new HtmlGenericControl("a");
                cell.Controls.Add(aSecure);
                aSecure.Attributes.Add("class", "show-modal-iframe");
                aSecure.Attributes.Add("height", "500px");
                aSecure.DataBinding += new EventHandler(aSecure_DataBinding);
            }
        }
Exemplo n.º 26
0
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);

            if (cellType == DataControlCellType.DataCell)
            {
                if (this.storageList.Parent == null)
                {
                    cell.Controls.Add(this.storageList);
                }
                this.InitializeDataCell(cell, rowState);
            }
        }
Exemplo n.º 27
0
    protected void GridMapped_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (DataControlRowType.DataRow == e.Row.RowType)
        {
            // check if the download id is null
            DownloadableItem currentRow = e.Row.DataItem as DownloadableItem;
            if (null != currentRow)
            {
                /************************************************/

                /* File Name Cell
                 * /************************************************/
                DataControlFieldCell fileNameCell = e.Row.Controls[0] as DataControlFieldCell;
                string fileNameText = string.Empty;
                if (string.IsNullOrEmpty(currentRow.FileName))
                {
                    // this should never happen
                    throw new InvalidOperationException("!!!");
                }
                else
                {
                    fileNameText = Security.HtmlEncode(currentRow.FileName);
                }

                fileNameCell.Text = fileNameText;


                /************************************************/

                /* Download Id Cell
                 * /************************************************/
                DataControlFieldCell cell = e.Row.Controls[2] as DataControlFieldCell;
                int counter = 0;


                using (SqlConnection con = DB.NewSqlConnection())
                {
                    con.Open();
                    using (IDataReader reader = DB.GetRSFormat(con, "SELECT Counter FROM InventoryItem with (NOLOCK) WHERE ItemCode = {0}", DB.SQuote(currentRow.ItemCode)))
                    {
                        if (reader.Read())
                        {
                            counter = DB.RSFieldInt(reader, "Counter");
                        }
                    }
                }

                cell.Text = string.Format("<a href=\"upload.aspx?id={0}\">{1}</a>", counter, currentRow.DownloadId);
            }
        }
    }
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     button = new ImageButton
     {
         ImageUrl      = "...",
         CommandName   = "Delete",
         OnClientClick = @"return confirm('Are you sure?');"
     };
     if (Click != null)
     {
         button.Click += Click;
     }
     cell.Controls.Add(button);
 }
Exemplo n.º 29
0
        /// <summary>
        /// Initializes the header.
        /// </summary>
        /// <param name="cell"></param>
        protected virtual void InitializeHeader(DataControlFieldCell cell)
        {
            if (this.AllowSelectAll && this.SelectionMode == ListSelectionMode.Multiple)
            {
                string text = cell.Text;

                this.selectAll = new SelectAllCheckBox();
                cell.Controls.Add(this.selectAll);
                this.selectAll.AutoPostBack = this.AutoPostBack;

                LiteralControl headerLabel = new LiteralControl(text);
                cell.Controls.Add(headerLabel);
            }
        }
Exemplo n.º 30
0
        public void DataControlField_InitilizeCell()
        {
            DerivedDataControlField field = new DerivedDataControlField();

            field.HeaderText            = "test";
            field.HeaderStyle.BackColor = Color.Red;
            field.HeaderImageUrl        = "test";
            DataControlFieldCell cell = new DataControlFieldCell(field);

            field.InitializeCell(cell, DataControlCellType.Header, DataControlRowState.Normal, 1);
            Assert.AreEqual("test", cell.ContainingField.HeaderText, "HeaderText");
            Assert.AreEqual("test", cell.ContainingField.HeaderImageUrl, "HeaderImageUrl");
            Assert.AreEqual(Color.Red, cell.ContainingField.HeaderStyle.BackColor, "BackColor");
        }
	public virtual void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex) {}
	// Methods
	public virtual void ExtractValuesFromCell(System.Collections.Specialized.IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly) {}
    protected void btn_Set_Click(object sender, EventArgs e)
    {
        #region
        DataSet Ds = new DataSet();        
        DataTable dtTemp = dtSelectDisChain;
        dtTemp.Clear();
        Int32 k = 0;

        string[] strAryChanNo = null;

        if (hiddenSelectedChanNo.Value.Trim() != "")
            strAryChanNo = hiddenSelectedChanNo.Value.Trim().Split(";".ToCharArray());

        if (strAryChanNo != null && strAryChanNo.Length > 0)
        {
            for (Int32 i = 0; i <= gv_Result.Rows.Count - 1; i++)
            {
                chk_Sgl = ((CheckBox)gv_Result.Rows[i].FindControl("chk_CHAN_NO_Sgl"));
                DCFC = ((DataControlFieldCell)gv_Result.Rows[i].Controls[1]);

                //if (chk_Sgl.Checked)
                //{
                for (Int32 x = 0; x <= strAryChanNo.GetUpperBound(0); x++)
                {
                    if (strAryChanNo[x] == chk_Sgl.Text.Trim())
                    {
                        DataRow dr = dtTemp.NewRow();
                        dr["rownum"] = k;
                        dr["CHAN_NO"] = chk_Sgl.Text.Trim().Replace("&nbsp;", "");
                        dr["CHAN_NAME"] = DCFC.Text;
                        dtTemp.Rows.Add(dr);
                        k++;
                        break;
                    }
                }
                //}
            }
        }



        dtSelectDisChain = dtTemp;
        if (dtTemp.DataSet == null)
        {
            Ds.Tables.Add(dtTemp);
        }
        ResultXML.InnerHtml = dtTemp.DataSet.GetXml();
        //將XML資料帶回ALO111.aspx 
        ScriptManager.RegisterStartupScript(this, this.GetType(), "", "window.returnValue= '" + ResultXML.InnerHtml.Replace("\r\n","")  + "';window.close();", true);        
        #endregion
    }