本文整理汇总了C#中GridItem.FindControl方法的典型用法代码示例。如果您正苦于以下问题:C# GridItem.FindControl方法的具体用法?C# GridItem.FindControl怎么用?C# GridItem.FindControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridItem
的用法示例。
在下文中一共展示了GridItem.FindControl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateExpandCollapseButton
public void CreateExpandCollapseButton(GridItem item, string columnUniqueName)
{
if (item is GridDataItem)
{
if (item.FindControl("MyExpandCollapseButton") == null)
{
Button button = new Button();
button.Click += new EventHandler(button_Click);
button.CommandName = "ExpandCollapse";
button.CssClass = (item.Expanded) ? "rgCollapse" : "rgExpand";
button.ID = "MyExpandCollapseButton";
if (item.OwnerTableView.HierarchyLoadMode == GridChildLoadMode.Client)
{
string script = String.Format(@"$find(""{0}"")._toggleExpand(this, event); return false;", item.Parent.Parent.ClientID);
button.OnClientClick = script;
}
int level = item.ItemIndexHierarchical.Split(':').Length;
if (level > 1)
{
button.Style["margin-left"] = level * 10 + "px";
}
TableCell cell = ((GridDataItem)item)[columnUniqueName];
cell.Controls.Add(button);
cell.Controls.Add(new LiteralControl(" "));
cell.Controls.Add(new LiteralControl(((GridDataItem)item).GetDataKeyValue(columnUniqueName).ToString()));
}
}
}
示例2: PopulateLine
protected void PopulateLine (GridItem item)
{
FinancialAccount account = (FinancialAccount)item.DataItem;
if (account == null)
{
return;
}
Label labelAccountName = (Label)item.FindControl("LabelAccountName");
Literal literalLastYear = (Literal)item.FindControl("LiteralLastYear");
Literal literalQ1 = (Literal)item.FindControl("LiteralQuarter1");
Literal literalQ2 = (Literal)item.FindControl("LiteralQuarter2");
Literal literalQ3 = (Literal)item.FindControl("LiteralQuarter3");
Literal literalQ4 = (Literal)item.FindControl("LiteralQuarter4");
Literal literalYtd = (Literal)item.FindControl("LiteralThisYear");
PopulateDualFigure(literalLastYear, "LastYear", 0, account.Identity);
PopulateDualFigure(literalQ1, "Q1", 1, account.Identity);
PopulateDualFigure(literalQ2, "Q2", 2, account.Identity);
PopulateDualFigure(literalQ3, "Q3", 3, account.Identity);
PopulateDualFigure(literalQ4, "Q4", 4, account.Identity);
PopulateDualFigure(literalYtd, "Ytd", 5, account.Identity);
labelAccountName.Text = account.Name;
}