本文整理汇总了C#中System.Web.UI.WebControls.TableRow.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# TableRow.Dispose方法的具体用法?C# TableRow.Dispose怎么用?C# TableRow.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.TableRow
的用法示例。
在下文中一共展示了TableRow.Dispose方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();//释放资源
}
示例2: 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);
//.........这里部分代码省略.........
示例3: 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);
}
}
}
}
}