当前位置: 首页>>代码示例>>C#>>正文


C# TableCell.Dispose方法代码示例

本文整理汇总了C#中System.Web.UI.WebControls.TableCell.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# TableCell.Dispose方法的具体用法?C# TableCell.Dispose怎么用?C# TableCell.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.WebControls.TableCell的用法示例。


在下文中一共展示了TableCell.Dispose方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitializeControls

		protected void InitializeControls() {
			this.panel = new Panel();

			Table table = new Table();
			try {
				TableRow row1, row2, row3;
				TableCell cell;
				table.Rows.Add(row1 = new TableRow());
				table.Rows.Add(row2 = new TableRow());
				table.Rows.Add(row3 = new TableRow());

				// top row, left cell
				cell = new TableCell();
				try {
					this.label = new HtmlGenericControl("label");
					this.label.InnerText = LabelTextDefault;
					cell.Controls.Add(this.label);
					row1.Cells.Add(cell);
				} catch {
					cell.Dispose();
					throw;
				}

				// top row, middle cell
				cell = new TableCell();
				try {
					cell.Controls.Add(new InPlaceControl(this));
					row1.Cells.Add(cell);
				} catch {
					cell.Dispose();
					throw;
				}

				// top row, right cell
				cell = new TableCell();
				try {
					this.loginButton = new Button();
					this.loginButton.ID = this.ID + "_loginButton";
					this.loginButton.Text = ButtonTextDefault;
					this.loginButton.ToolTip = ButtonToolTipDefault;
					this.loginButton.Click += this.LoginButton_Click;
					this.loginButton.ValidationGroup = ValidationGroupDefault;
#if !Mono
					this.panel.DefaultButton = this.loginButton.ID;
#endif
					cell.Controls.Add(this.loginButton);
					row1.Cells.Add(cell);
				} catch {
					cell.Dispose();
					throw;
				}

				// middle row, left cell
				row2.Cells.Add(new TableCell());

				// middle row, middle cell
				cell = new TableCell();
				try {
					cell.Style[HtmlTextWriterStyle.Color] = "gray";
					cell.Style[HtmlTextWriterStyle.FontSize] = "smaller";
					this.requiredValidator = new RequiredFieldValidator();
					this.requiredValidator.ErrorMessage = RequiredTextDefault + RequiredTextSuffix;
					this.requiredValidator.Text = RequiredTextDefault + RequiredTextSuffix;
					this.requiredValidator.Display = ValidatorDisplay.Dynamic;
					this.requiredValidator.ValidationGroup = ValidationGroupDefault;
					cell.Controls.Add(this.requiredValidator);
					this.identifierFormatValidator = new CustomValidator();
					this.identifierFormatValidator.ErrorMessage = UriFormatTextDefault + RequiredTextSuffix;
					this.identifierFormatValidator.Text = UriFormatTextDefault + RequiredTextSuffix;
					this.identifierFormatValidator.ServerValidate += this.IdentifierFormatValidator_ServerValidate;
					this.identifierFormatValidator.Enabled = UriValidatorEnabledDefault;
					this.identifierFormatValidator.Display = ValidatorDisplay.Dynamic;
					this.identifierFormatValidator.ValidationGroup = ValidationGroupDefault;
					cell.Controls.Add(this.identifierFormatValidator);
					this.errorLabel = new Label();
					this.errorLabel.EnableViewState = false;
					this.errorLabel.ForeColor = System.Drawing.Color.Red;
					this.errorLabel.Style[HtmlTextWriterStyle.Display] = "block"; // puts it on its own line
					this.errorLabel.Visible = false;
					cell.Controls.Add(this.errorLabel);
					this.examplePrefixLabel = new Label();
					this.examplePrefixLabel.Text = ExamplePrefixDefault;
					cell.Controls.Add(this.examplePrefixLabel);
					cell.Controls.Add(new LiteralControl(" "));
					this.exampleUrlLabel = new Label();
					this.exampleUrlLabel.Font.Bold = true;
					this.exampleUrlLabel.Text = ExampleUrlDefault;
					cell.Controls.Add(this.exampleUrlLabel);
					row2.Cells.Add(cell);
				} catch {
					cell.Dispose();
					throw;
				}

				// middle row, right cell
				cell = new TableCell();
				try {
					cell.Style[HtmlTextWriterStyle.Color] = "gray";
					cell.Style[HtmlTextWriterStyle.FontSize] = "smaller";
					cell.Style[HtmlTextWriterStyle.TextAlign] = "center";
//.........这里部分代码省略.........
开发者ID:enslam,项目名称:dotnetopenid,代码行数:101,代码来源:OpenIdLogin.cs

示例2: PrepareControlHierarchy

        /// <summary>
        /// Prepares the control hierarchy.
        /// </summary>
        protected virtual void PrepareControlHierarchy()
        {
            TableRow row = new TableRow();

            TableCell inputCell = new TableCell();
            inputCell.Controls.Add(txbValidateCodeInput);
            row.Cells.Add(inputCell);
            inputCell.Dispose();//释放资源

            TableCell imageCell = new TableCell();
            imageCell.Controls.Add(imgValidateCodeImage);
            row.Cells.Add(imageCell);
            imageCell.Dispose();//释放资源

            TableCell linkCell = new TableCell();
            linkCell.Controls.Add(linkRefreshValidateCode);
            row.Cells.Add(linkCell);
            linkCell.Dispose();//释放资源

            Controls.Add(row);
            row.Dispose();//释放资源
        }
开发者ID:cathychen00,项目名称:003.DianZiShangWu,代码行数:25,代码来源:ValidateCodeControl.cs

示例3: PrepareControlHierarchy

        protected virtual void PrepareControlHierarchy()
        {
            switch (_enumPreViewPosition)
            {
                case PreViewPosition.Top:
                    TableRow rowPreview = new TableRow();
                    TableCell cellPreview = new TableCell();
                    cellPreview.ColumnSpan = 2;
                    cellPreview.Controls.Add(_imgPreView);
                    rowPreview.Cells.Add(cellPreview);
                    cellPreview.Dispose();//释放资源
                    Controls.Add(rowPreview);
                    rowPreview.Dispose();//释放资源

                    TableRow rowUpload = new TableRow();
                    TableCell cellUploadSelector = new TableCell();
                    cellUploadSelector.Controls.Add(_fileUpload);
                    rowUpload.Cells.Add(cellUploadSelector);
                    cellUploadSelector.Dispose();//释放资源

                    TableCell cellSaveButton = new TableCell();
                    cellSaveButton.Controls.Add(_btnSave);
                    rowUpload.Cells.Add(cellSaveButton);
                    cellSaveButton.Dispose();//释放资源
                    Controls.Add(rowUpload);

                    rowUpload.Dispose();//释放资源
                    break;
                case PreViewPosition.Right:
                    TableRow rowUpload1 = new TableRow();
                    TableCell cellUploadSelector1 = new TableCell();
                    cellUploadSelector1.Controls.Add(_fileUpload);
                    rowUpload1.Cells.Add(cellUploadSelector1);
                    cellUploadSelector1.Dispose();//释放资源

                    TableCell cellSaveButton1 = new TableCell();
                    cellSaveButton1.Controls.Add(_btnSave);
                    rowUpload1.Cells.Add(cellSaveButton1);
                    cellSaveButton1.Dispose();//释放资源
                    Controls.Add(rowUpload1);

                    TableCell cellPreview1 = new TableCell();
                    cellPreview1.Controls.Add(_imgPreView);
                    rowUpload1.Cells.Add(cellPreview1);
                    cellPreview1.Dispose();//释放资源
                    Controls.Add(rowUpload1);

                    rowUpload1.Dispose();//释放资源
                    break;
                case PreViewPosition.Bottom:
                    TableRow rowUpload2 = new TableRow();
                    TableCell cellUploadSelector2 = new TableCell();
                    cellUploadSelector2.Controls.Add(_fileUpload);
                    rowUpload2.Cells.Add(cellUploadSelector2);
                    cellUploadSelector2.Dispose();//释放资源

                    TableCell cellSaveButton2 = new TableCell();
                    cellSaveButton2.Controls.Add(_btnSave);
                    rowUpload2.Cells.Add(cellSaveButton2);
                    cellSaveButton2.Dispose();//释放资源
                    Controls.Add(rowUpload2);

                    rowUpload2.Dispose();//释放资源

                    TableRow rowPreview2 = new TableRow();
                    TableCell cellPreview2 = new TableCell();
                    cellPreview2.ColumnSpan = 2;
                    cellPreview2.Controls.Add(_imgPreView);
                    rowPreview2.Cells.Add(cellPreview2);
                    cellPreview2.Dispose();//释放资源
                    Controls.Add(rowPreview2);
                    rowPreview2.Dispose();//释放资源
                    break;
                case PreViewPosition.Left:
                    TableRow rowUpload3 = new TableRow();

                    TableCell cellPreview3 = new TableCell();
                    cellPreview3.Controls.Add(_imgPreView);
                    rowUpload3.Cells.Add(cellPreview3);
                    cellPreview3.Dispose();//释放资源
                    Controls.Add(rowUpload3);

                    TableCell cellUploadSelector3 = new TableCell();
                    cellUploadSelector3.Controls.Add(_fileUpload);
                    rowUpload3.Cells.Add(cellUploadSelector3);
                    cellUploadSelector3.Dispose();//释放资源

                    TableCell cellSaveButton3 = new TableCell();
                    cellSaveButton3.Controls.Add(_btnSave);
                    rowUpload3.Cells.Add(cellSaveButton3);
                    cellSaveButton3.Dispose();//释放资源
                    Controls.Add(rowUpload3);

                    rowUpload3.Dispose();//释放资源
                    break;
                default:
                    TableRow rowUpload4 = new TableRow();
                    TableCell cellUploadSelector4 = new TableCell();
                    cellUploadSelector4.Controls.Add(_fileUpload);
                    rowUpload4.Cells.Add(cellUploadSelector4);
//.........这里部分代码省略.........
开发者ID:cathychen00,项目名称:003.DianZiShangWu,代码行数:101,代码来源:ImageUploader.cs

示例4: SetGridViewSortImages


//.........这里部分代码省略.........
                        DescImageRow = new TableRow();
                        DescImageRow.BackColor = Color.Transparent;
                        DescImageCell = new TableCell();
                        DescImageCell.BorderWidth = new Unit(0);
                        DescImageCell.Style.Add(HtmlTextWriterStyle.Padding, "0");
                        DescImageCell.Style.Add(HtmlTextWriterStyle.Margin, "0");
                        DescImageRow.Cells.Add(DescImageCell);

                        imagesCell = new TableCell();
                        imagesCell.Width = new Unit(1);
                        imagesCell.BorderWidth = new Unit(0);
                        imagesCell.Style.Add(HtmlTextWriterStyle.Padding, "0");
                        imagesCell.Style.Add(HtmlTextWriterStyle.Margin, "0");
                        imagesCell.Controls.Add(imageTable);

                        row = new TableRow();
                        row.BackColor = Color.Transparent;

                        headerTextCell = new TableCell();
                        headerTextCell.BorderWidth = new Unit(0);
                        headerTextCell.Style.Add(HtmlTextWriterStyle.Padding, "0");
                        headerTextCell.Style.Add(HtmlTextWriterStyle.Margin, "0");
                        headerTextCell.HorizontalAlign = HorizontalAlign.Left;
                        Label HeaderLabel = new Label();
                        HeaderLabel.CssClass = headerTextCssClass;
                        headerTextCell.Controls.Add(HeaderLabel);

                        if (tc.HasControls())
                        {
                            // search for the header link
                            LinkButton lnk = tc.Controls[0] as LinkButton;
                            if (lnk != null)
                            {
                                ImageButton imgBtnUp = new ImageButton();
                                ImageButton imgBtnDown = new ImageButton();
                                imgBtnUp.ID = "imgAsc" + i.ToString();
                                imgBtnDown.ID = "imgDesc" + i.ToString();
                                i++;
                                imgBtnUp.Click += new ImageClickEventHandler(ascClickEventHandler);
                                imgBtnDown.Click += new ImageClickEventHandler(descClickEventHandler);
                                imgBtnUp.CommandName = lnk.CommandName;
                                imgBtnDown.CommandName = lnk.CommandName;
                                imgBtnUp.CommandArgument = lnk.CommandArgument;
                                imgBtnDown.CommandArgument = lnk.CommandArgument;

                                //--set the properties
                                HeaderLabel.Text = lnk.Text.Trim();

                                imgBtnUp.ImageUrl = ascImageFilePath;
                                imgBtnUp.AlternateText = "ascending";
                                imgBtnDown.ImageUrl = descImageFilePage;
                                imgBtnDown.AlternateText = "descending";

                                //// checking if the header link is the user's choice
                                if (sortExpression != lnk.CommandArgument || sortDirection == "DESC")
                                {
                                    AscImageCell.Controls.Add(imgBtnUp);
                                    imageTable.Rows.Add(AscImageRow);
                                }
                                if (sortExpression != lnk.CommandArgument || sortDirection == "ASC")
                                {
                                    DescImageCell.Controls.Add(imgBtnDown);
                                    imageTable.Rows.Add(DescImageRow);
                                }

                                //--this will remove the clickable column header link button that is automatically created
                                //--when adding sorting capabilities to a gridview
                                tc.Controls.RemoveAt(0);

                                if (!AscImageCell.HasControls())
                                {
                                    AscImageCell.Dispose();
                                    AscImageRow.Dispose();
                                }
                                if (!DescImageCell.HasControls())
                                {
                                    DescImageCell.Dispose();
                                    DescImageRow.Dispose();
                                }
                                row.Cells.Add(imagesCell);
                                row.Cells.Add(headerTextCell);
                                table.Rows.Add(row);
                                tc.Style.Add(HtmlTextWriterStyle.VerticalAlign, "middle");
                                tc.Controls.Add(table);
                            }
                        }
                        else
                        {
                            imagesCell.Dispose();
                            HeaderLabel.Text = tc.Text;
                            headerTextCell.VerticalAlign = VerticalAlign.Middle;
                            row.Cells.Add(headerTextCell);
                            table.Rows.Add(row);
                            tc.Style.Add(HtmlTextWriterStyle.VerticalAlign, "middle");
                            tc.Controls.Add(table);
                        }
                    }
                }
            }
        }
开发者ID:jmptrader,项目名称:WebFrameworkMVC,代码行数:101,代码来源:GridViewUtil.cs


注:本文中的System.Web.UI.WebControls.TableCell.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。