コード例 #1
0
ファイル: Toolbar.cs プロジェクト: yangkai1992/sz1card1
 /// <summary>
 /// Handles toolbar item events.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Items_ItemSubmitted(ToolbarItem item)
 {
     //bubble event
     if (ItemPostBack != null) ItemPostBack(item);
 }
コード例 #2
0
ファイル: Toolbar.cs プロジェクト: yangkai1992/sz1card1
        /// <summary>
        /// Renders a table cell of a given toolbar item.
        /// </summary>
        /// <param name="item">Item to be rendered.</param>
        /// <param name="writer">Writer that streams output to the client.</param>
        protected void RenderItemCell(ToolbarItem item, HtmlTextWriter writer)
        {
            TableCell cell = new TableCell();
            cell.HorizontalAlign = item.HorizontalAlign;
            cell.VerticalAlign = item.VerticalAlign;

            if (item is ToolbarSeparator)
            {
                //set separator height (custom if set or toolbar property)
                if (this.Orientation == ToolbarOrientation.Horizontal)
                    //set the cell width on a horizontal toolbar
                    cell.Width = item.ItemCellDistance == Unit.Empty ? this.SeparatorCellDistance : item.ItemCellDistance;
                else
                    //set the cell height on a vertical toolbar
                    cell.Height = item.ItemCellDistance == Unit.Empty ? this.SeparatorCellDistance : item.ItemCellDistance;

                if (this.SeparatorImageUrl != String.Empty)
                {
                    Image img = new Image();
                    img.ImageUrl = this.SeparatorImageUrl;
                    cell.Controls.Add(img);
                }
                else
                {
                    cell.Text = "&nbsp;";
                }
                cell.RenderControl(writer);
            }
            else
            {
                if (this.Orientation == ToolbarOrientation.Horizontal)
                    //set the cell width on a horizontal toolbar
                    cell.Width = item.ItemCellDistance == Unit.Empty ? this.ItemCellDistance : item.ItemCellDistance;
                else
                    //set the cell height on a vertical toolbar
                    cell.Height = item.ItemCellDistance == Unit.Empty ? this.ItemCellDistance : item.ItemCellDistance;

                //render the item
                cell.RenderBeginTag(writer);
                item.RenderControl(writer);
                cell.RenderEndTag(writer);
            }
        }
コード例 #3
0
ファイル: Toolbar.cs プロジェクト: yangkai1992/sz1card1
 /// <summary>
 /// Removes an item from the internal <c>Controls</c>
 /// collection.
 /// </summary>
 /// <param name="item"></param>
 protected void items_ItemRemoved(ToolbarItem item)
 {
     this.Controls.Remove(item);
 }
コード例 #4
0
ファイル: Toolbar.cs プロジェクト: yangkai1992/sz1card1
        /// <summary>
        /// Adds a new item to the internal <c>Controls</c>
        /// collection.
        /// </summary>
        /// <param name="item"></param>
        protected void items_ItemAdded(ToolbarItem item)
        {
            this.Controls.Add(item);

            if (item is IPostBackToolbarItem)
            {
                //register click event handler
                ((IPostBackToolbarItem)item).ItemSubmitted += new ItemEventHandler(Items_ItemSubmitted);
            }
        }
コード例 #5
0
 /// <summary>
 /// Gets the index of a toolbar item.
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public int IndexOf(ToolbarItem item)
 {
     return this.List.IndexOf(item);
 }
コード例 #6
0
 /// <summary>
 /// Adds an item to the list.
 /// </summary>
 /// <param name="item"></param>
 public void Add(ToolbarItem item)
 {
     if (item.ItemId == String.Empty) item.ItemId = item.ID;
     this.List.Add(item);
 }
コード例 #7
0
 /// <summary>
 /// Adds an item at a given position.
 /// </summary>
 /// <param name="index">Zero-based index of the item.</param>
 /// <param name="item">Item to be added.</param>
 public void Insert(int index, ToolbarItem item)
 {
     this.List.Insert(index, item);
 }