本文整理汇总了C#中System.Web.UI.WebControls.TableRow.RenderControl方法的典型用法代码示例。如果您正苦于以下问题:C# TableRow.RenderControl方法的具体用法?C# TableRow.RenderControl怎么用?C# TableRow.RenderControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.TableRow
的用法示例。
在下文中一共展示了TableRow.RenderControl方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderContents
/// <summary>
/// 绘制内容。
/// </summary>
/// <param name="writer"></param>
protected override void RenderContents(HtmlTextWriter writer)
{
if (this.Page != null && this.Items.Count > 0)
{
TableRow tr = null;
TableCell cell = null;
string strName = this.GetType().Name;
foreach (TreeViewNode item in this.Items)
{
if (item.Childs.Count > 0)
{
//outlook
tr = new TableRow();
cell = new TableCell();
cell.Width = new Unit("100%");
cell.Height = new Unit("30px");
cell.VerticalAlign = VerticalAlign.Middle;
cell.HorizontalAlign = HorizontalAlign.Center;
cell.Style.Add(HtmlTextWriterStyle.BackgroundImage, string.Format("url({0})", this.GetImageUrl(item.Expand)));
cell.Style.Add(HtmlTextWriterStyle.Cursor, "pointer");
cell.Text = cell.ToolTip = item.Text;
cell.Attributes.Add("onclick", string.Format("{0}_openOutlook(this);", strName));
tr.Cells.Add(cell);
tr.RenderControl(writer);
#region childs。
tr = new TableRow();
if (!item.Expand)
tr.Style.Add(HtmlTextWriterStyle.Display, "none");
cell = new TableCell();
cell.Width = new Unit("100%");
cell.VerticalAlign = VerticalAlign.Top;
this.CreateTreeView(item, cell);
tr.Cells.Add(cell);
tr.RenderControl(writer);
#endregion
}
}
}
}
示例2: CreateDataItem
void CreateDataItem(int index, bool bReadOnly, bool bAllowDownd, UploadViewDataItem item, HtmlTextWriter writer)
{
if (item != null)
{
TableRow row = new TableRow();
row.CssClass = (index % 2 == 0) ? this.DataItemNormalClass : this.DataItemAlterClass;
TableCell cell = null;
if (!bReadOnly)
{
cell = new TableCell();
cell.HorizontalAlign = HorizontalAlign.Center;
HtmlInputCheckBox chk = new HtmlInputCheckBox();
chk.ID = chk.Name = string.Format("{0}_CHK_{1}", this.ClientID, item.FileID);
chk.Value = item.FileID;
cell.Controls.Add(chk);
row.Cells.Add(cell);
}
string downloadBaseURI = this.DownloadBaseURI;
if (bAllowDownd && !this.UploadRaws.ContainsKey(item.FileID) && !string.IsNullOrEmpty(downloadBaseURI))
{
cell = new TableCell();
cell.HorizontalAlign = HorizontalAlign.Left;
HtmlAnchor a = new HtmlAnchor();
a.InnerText = string.Format("{0}.{1}", index + 1, item.FileName);
string[] exts = this.OfficeSuffix.Split('|');
if (!this.ReadOnly && this.AllowOfficeOnlineEdit && exts != null && exts.Length > 0 && (Array.BinarySearch(exts, item.Extension.ToLower()) > -1))
{
string url = string.Empty;
if (downloadBaseURI.IndexOf("/") > 0)
url = downloadBaseURI.Substring(0, downloadBaseURI.LastIndexOf("/"));
if (string.IsNullOrEmpty(url))
url = string.Format("http://{0}/", HttpContext.Current.Request.Url.Host);
url = string.Format("{0}{1}{2}", url, item.FileID, item.Extension);
a.HRef = "#";
a.Attributes["onclick"] = string.Format("javascript:UploadView_DocumentEdit('{0}');", url);
}
else
{
a.HRef = string.Format("{0}{1}", downloadBaseURI, item.FileID);
a.Target = "_blank";
}
cell.Controls.Add(a);
row.Cells.Add(cell);
}
else
{
cell = new TableCell();
cell.HorizontalAlign = HorizontalAlign.Left;
cell.Text = string.Format("{0}.{1}", index + 1, item.FileName);
row.Cells.Add(cell);
}
cell = new TableCell();
cell.HorizontalAlign = HorizontalAlign.Left;
cell.Text = item.Extension;
row.Cells.Add(cell);
cell = new TableCell();
cell.HorizontalAlign = HorizontalAlign.Right;
cell.Text = item.Size < 0.01 ? "< 0.01" : string.Format("{0:N2}", item.Size);
row.Cells.Add(cell);
row.RenderControl(writer);
}
}
示例3: RenderContents
//.........这里部分代码省略.........
image.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(TreeView), "iPower.Web.TreeView.openfolder.gif");
else
image.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(TreeView), "iPower.Web.TreeView.closedfolder.gif");
cell_1.Width = new Unit("16px");
cell_1.Controls.Add(image);
tr.Cells.Add(cell_1);
if (this.ShowCheckBox)
{
TableCell cellBox = new TableCell();
cellBox.Width = new Unit("17px");
if (this.CheckType == CheckBoxType.CheckBox)
{
HtmlInputCheckBox checkBox = new HtmlInputCheckBox();
checkBox.ID = string.Format("{0}_chkb_{1}", this.ClientID, item.Value);
checkBox.Name = string.Format("{0}_chkb", this.ClientID);
checkBox.Value = item.Value;
if (this.EnabledCheckValueChecked)
checkBox.Checked = this.checkedValueCollection.Contains(item.Value);
else
checkBox.Checked = item.Checked;
checkBox.Attributes.Add("onclick", string.Format("javascript:{0}_CheckAll(this);", this.GetType().Name));
cellBox.Controls.Add(checkBox);
}
else
{
HtmlInputRadioButton radio = new HtmlInputRadioButton();
radio.ID = string.Format("{0}_rd_{1}", this.ClientID, item.Value);
radio.Name = string.Format("{0}_rd", this.ClientID);
radio.Value = item.Value;
if (this.EnabledCheckValueChecked)
radio.Checked = this.checkedValueCollection.Contains(item.Value);
else
radio.Checked = item.Checked;
cellBox.Controls.Add(radio);
}
tr.Cells.Add(cellBox);
}
cell_2 = new TableCell();
cell_2.Width = new Unit("100%");
cell_2.HorizontalAlign = HorizontalAlign.Left;
if (!string.IsNullOrEmpty(item.HrefURL) || !string.IsNullOrEmpty(item.ClickAction) || this.EnabledNodeClickEvent)
{
HtmlAnchor link = new HtmlAnchor();
link.Attributes.Add("class", "TreeViewA");
if (this.CurrentFolderValue == item.Value)
{
HtmlGenericControl span = new HtmlGenericControl("span");
span.Attributes.Add("class", "TreeViewCurrentNode");
span.InnerText = item.Text;
link.Controls.Add(span);
}
else
link.Controls.Add(new LiteralControl(item.Text));
link.HRef = string.IsNullOrEmpty(item.HrefURL) ? "#" : item.HrefURL;
if (this.EnabledNodeClickEvent && this.Page != null)
link.Attributes.Add("onclick", this.Page.ClientScript.GetPostBackEventReference(this, HttpUtility.HtmlEncode(item.Value)));
else if (!string.IsNullOrEmpty(item.ClickAction))
link.Attributes.Add("onclick", item.ClickAction);
cell_2.Controls.Add(link);
cell_2.Style.Add(HtmlTextWriterStyle.Cursor, "pointer");
}
else
cell_2.Text = item.Text;
tr.Cells.Add(cell_2);
tr.RenderControl(writer);
if (item.Childs.Count > 0)
{
tr = new TableRow();
if (!item.Expand)
tr.Style.Add(HtmlTextWriterStyle.Display, "none");
cell_0 = new TableCell();
cell_0.Width = new Unit("17px");
if (i < len - 1)
{
cell_0.Style.Add(HtmlTextWriterStyle.BackgroundImage, string.Format("url({0})",
this.Page.ClientScript.GetWebResourceUrl(typeof(TreeView), "iPower.Web.TreeView.I.gif")));
}
else if (i != len - 1)
{
image = new System.Web.UI.WebControls.Image();
image.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(TreeView), "iPower.Web.TreeView.L.gif");
cell_0.Controls.Add(image);
}
tr.Cells.Add(cell_0);
cell_1 = new TableCell();
cell_1.Width = new Unit("100%");
cell_1.ColumnSpan = this.ShowCheckBox ? 3 : 2;
this.CreateTreeView(item, cell_1);
cell_1.VerticalAlign = VerticalAlign.Top;
tr.Cells.Add(cell_1);
tr.RenderControl(writer);
}
}
}
}
示例4: RenderContents
/// <summary>
///
/// </summary>
/// <param name="writer"></param>
protected override void RenderContents(HtmlTextWriter writer)
{
string[][] headers = new string[][] { new string[]{"文件名","65%"},
new string[]{"后缀名","15%"},
new string[]{"文件大小(M)","20%"}};
#region 表头。
TableRow headerRow = new TableRow();
headerRow.CssClass = this.DataItemHeaderClass;
TableCell cell = null;
if (!this.ReadOnly && this.ShowDeleteButtom)
{
cell = new TableCell();
cell.Width = new Unit("8px");
HtmlInputCheckBox chk = new HtmlInputCheckBox();
chk.ID = string.Format("{0}_chkSelectAll", this.ClientID);
chk.Attributes["onclick"] = string.Format("javascript:UploadView_SelectAll('{0}',this);", this.ClientID);
cell.Controls.Add(chk);
headerRow.Cells.Add(cell);
}
foreach (string[] h in headers)
{
cell = new TableCell();
cell.Width = new Unit(h[1]);
cell.Text = h[0];
headerRow.Cells.Add(cell);
}
headerRow.RenderControl(writer);
#endregion
#region 表体。
UploadViewDataItemCollection itemCollection = this.Items;
if (itemCollection != null && itemCollection.Count > 0)
{
int len = itemCollection.Count;
bool bReadOnly = this.ReadOnly;
if (!bReadOnly)
bReadOnly = !this.ShowDeleteButtom;
bool bAllowDown = this.AllowDownload;
for (int i = 0; i < len; i++)
{
this.CreateDataItem(i, bReadOnly, bAllowDown, itemCollection[i], writer);
}
}
#endregion
if (!this.ReadOnly)
{
TableRow footer = new TableRow();
footer.CssClass = this.DataItemFooterClass;
TableCell footerCell = new TableCell();
footerCell.ColumnSpan = headers.Length + 1;
this.CreateUploadDeleteBtn(footerCell);
this.CreateUpload(footerCell);
footer.Cells.Add(footerCell);
footer.RenderControl(writer);
}
}
示例5: RenderContents
/// <summary>
///
/// </summary>
/// <param name="writer"></param>
protected override void RenderContents(HtmlTextWriter writer)
{
TableRow headRow = new TableRow();
headRow.CssClass = this.TabHeaderCssName;
TableCell cell = new TableCell();
cell.Width = new Unit("100%");
cell.VerticalAlign = VerticalAlign.Middle;
TabViewCollection tabCollection = (TabViewCollection)this.TabViewControls;
if (tabCollection != null && tabCollection.Count > 0)
{
string seletedCssName = this.TabHeaderSelectedCssName;
string normalCssName = this.TabHeaderNormalCssName;
string highLightCssName = this.TabHeaderHighLightCssName;
int defaultActiveIndex = this.DefaultActiveTabIndex;
for (int i = 0; i < tabCollection.Count; i++)
{
TabView tab = tabCollection[i];
if (tab != null && tab.Visible)
{
HtmlGenericControl span = new HtmlGenericControl("span");
span.Attributes["style"] = "float:left;cursor:hand;";
span.InnerText = tab.Text;
span.Attributes["title"] = tab.Text;
span.Attributes["tagViewID"] = tab.ClientID;
span.Attributes["onclick"] = this.EnableServerActive ?
string.Format("javascript:{0};", this.Page.ClientScript.GetPostBackEventReference(this, "Active$" + tab.Index.ToString()))
: string.Format("javasscript:{0}_SelectdTab(this);", this.ClientID);
span.Attributes["class"] = span.Attributes["oclass"] = (tab.Index == defaultActiveIndex) ? seletedCssName : normalCssName;
span.Attributes["onmouseout"] = "this.className=this.oclass;";
span.Attributes["onmouseover"] = string.Format("this.className='{0}';", highLightCssName);
cell.Controls.Add(span);
}
}
}
headRow.Cells.Add(cell);
headRow.RenderControl(writer);
//tr
writer.AddStyleAttribute(HtmlTextWriterStyle.VerticalAlign, "top");
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
//td
writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
writer.AddStyleAttribute(HtmlTextWriterStyle.Height, "100%");
writer.AddAttribute(HtmlTextWriterAttribute.Class, this.TabBackgroundCssName);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
if (tabCollection != null && tabCollection.Count > 0)
{
for (int i = 0; i < tabCollection.Count; i++)
{
TabView tab = tabCollection[i];
if (tab != null && tab.Visible)
tab.RenderControl(writer);
}
}
//base.RenderContents(writer);
//end td
writer.RenderEndTag();
//end tr
writer.RenderEndTag();
}