本文整理汇总了C#中System.Web.UI.WebControls.RepeaterItemEventArgs.FindControlAs方法的典型用法代码示例。如果您正苦于以下问题:C# RepeaterItemEventArgs.FindControlAs方法的具体用法?C# RepeaterItemEventArgs.FindControlAs怎么用?C# RepeaterItemEventArgs.FindControlAs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.RepeaterItemEventArgs
的用法示例。
在下文中一共展示了RepeaterItemEventArgs.FindControlAs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: rptRow_ItemDataBound
protected void rptRow_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.IsItem())
{
Item dataItem = e.Item.DataItem as Item;
if(dataItem.InheritsTemplate(DefaultArticlePageItem.TemplateId))
{
DefaultArticlePageItem article = (DefaultArticlePageItem)dataItem;
System.Web.UI.WebControls.Image imgThumbnail = e.FindControlAs<System.Web.UI.WebControls.Image>("imgThumbnail");
HyperLink hypArticleLink = e.FindControlAs<HyperLink>("hypArticleLink");
HyperLink hypThumbnail = e.FindControlAs<HyperLink>("hypThumbnail");
if (imgThumbnail != null)
imgThumbnail.ImageUrl = article.GetArticleThumbnailUrl(230, 129);
if (hypArticleLink != null)
{
hypArticleLink.NavigateUrl = hypThumbnail.NavigateUrl = article.GetUrl();
hypArticleLink.Text = article.ContentPage.PageTitle;
}
}
}
}
示例2: rptMainNavigation_ItemDataBound
protected void rptMainNavigation_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.IsItem())
{
var item = e.Item.DataItem as NavigationLinkItem;
if (item != null)
{
var frMainNavigationLink = e.FindControlAs<FieldRenderer>("frMainNavigationLink");
if (frMainNavigationLink != null)
{
frMainNavigationLink.Item = item;
}
var results = item.GetNavigationLinkItems();
if (results != null && results.Any())
{
var rptPrimaryNav = e.FindControlAs<Repeater>("rptPrimaryNavigation");
if (rptPrimaryNav != null)
{
rptPrimaryNav.DataSource = results;
rptPrimaryNav.DataBind();
}
}
}
}
}
示例3: rptWelcomeSlider_ItemDataBound
protected void rptWelcomeSlider_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.IsItem())
{
WelcomeTourItem item = e.Item.DataItem as WelcomeTourItem;
if (item != null)
{
Sitecore.Web.UI.WebControls.Image scBackgroundImage = e.FindControlAs<Sitecore.Web.UI.WebControls.Image>("scBackgroundImage");
FieldRenderer frContent = e.FindControlAs<FieldRenderer>("frContent");
Link scLinkJoin = e.FindControlAs<Link>("scLinkJoin");
HyperLink hlNotNow = e.FindControlAs<HyperLink>("hlNotNow");
if (frContent != null)
{
frContent.Item = item;
}
if (scBackgroundImage != null)
{
scBackgroundImage.Item = item;
}
if (scLinkJoin != null)
{
scLinkJoin.Item = item;
}
if (hlNotNow != null)
{
hlNotNow.Text = DictionaryConstants.NotNowLabel;
}
}
}
}
示例4: rptHeaderChkbox_ItemDataBound
protected void rptHeaderChkbox_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
HeaderCheckboxItem HeadItem = e.Item.DataItem as HeaderCheckboxItem;
if (HeadItem != null)
{
FieldRenderer frHeaderItem = e.FindControlAs<FieldRenderer>("frHeaderItem");
if (frHeaderItem != null)
{
frHeaderItem.Item = HeadItem;
List<TopicCheckboxItem> Topics = ChecklistArticlePageItem.GetAllTopicItem(HeadItem);
if (Topics != null)
{
Repeater rptTopicChkbox = e.FindControlAs<Repeater>("rptTopicChkbox");
if (rptTopicChkbox != null)
{
rptTopicChkbox.DataSource = Topics;
rptTopicChkbox.DataBind();
}
}
}
}
}
示例5: rptPromoDetails_ItemDataBound
protected void rptPromoDetails_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.IsItem())
{
PromoItem currentPromo = e.Item.DataItem as PromoItem;
if (currentPromo != null)
{
Panel pnlImageType = e.FindControlAs<Panel>("pnlImageType");
if (pnlImageType != null)
{
if (currentPromo.ShowMediaFile.Checked==true)
{
pnlImageType.CssClass+=" video";
}
HyperLink hlPromoMedia = e.FindControlAs<HyperLink>("hlPromoMedia");
if (hlPromoMedia != null)
{
FieldRenderer frPromoMedia = e.FindControlAs<FieldRenderer>("frPromoMedia");
if (frPromoMedia != null)
{
frPromoMedia.Item = currentPromo;
}
}
FieldRenderer frPromoTitle = e.FindControlAs<FieldRenderer>("frPromoTitle");
if (frPromoTitle != null)
{
frPromoTitle.Item = currentPromo;
}
}
}
}
}
示例6: rptSlideButtons_ItemDataBound
void rptSlideButtons_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Header)
{
Literal ltlPrev = e.FindControlAs<Literal>("ltlPrev");
ltlPrev.Text = DictionaryConstants.PrevTipButtonText;
}
if (e.IsItem())
{
string buttonNumber = (e.Item.ItemIndex + 1).ToString();
HtmlButton hgcButton = e.FindControlAs<HtmlButton>("hgcButton");
hgcButton.InnerText = buttonNumber;
hgcButton.Attributes["data-target"] = buttonNumber;
}
if (e.Item.ItemType == ListItemType.Footer)
{
Literal ltlNext = e.FindControlAs<Literal>("ltlNext");
Literal ltlLast = e.FindControlAs<Literal>("ltlLast");
ltlNext.Text = DictionaryConstants.NextTipButtonText;
ltlLast.Text = DictionaryConstants.LastTipButtonText;
}
}
示例7: rptChildIssues_ItemDataBound
protected void rptChildIssues_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.IsItem())
{
ChildIssueItem childIssueItem = e.Item.DataItem as ChildIssueItem;
HtmlInputCheckBox inputIssue = e.FindControlAs<HtmlInputCheckBox>("inputIssue");
Literal litIssueName = e.FindControlAs<Literal>("litIssueName");
inputIssue.Attributes.Add("data-id", childIssueItem.ID.ToString());
litIssueName.Text = childIssueItem.IssueName.Raw;
}
}
示例8: rptLinks_ItemDataBound
private void rptLinks_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.IsItem())
{
NavigationLinkItem item = (NavigationLinkItem)e.Item.DataItem;
FieldRenderer frLink = e.FindControlAs<FieldRenderer>("frLink");
frLink.Item = item;
if (item.Link.Field != null)
{
// Handle initial menu choice
if (e.Item.ItemIndex == 0)
{
litInitialMenuChoice.Text = item.Link.Field.Text;
}
// Selected state
Item navItem = Sitecore.Context.Item;
while (navItem != null)
{
if (item.Link.Field.TargetID == navItem.ID)
{
frLink.Parameters = "class=selected";
break;
}
navItem = navItem.Parent;
}
}
}
}
示例9: rptArticles_ItemDataBound
void rptArticles_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.IsItem())
{
DefaultArticlePageItem item = (DefaultArticlePageItem)e.Item.DataItem;
HyperLink hlArticleDetail = e.FindControlAs<HyperLink>("hlArticleDetail");
hlArticleDetail.NavigateUrl = item.GetUrl();
System.Web.UI.WebControls.Image imgThumbnail = e.FindControlAs<System.Web.UI.WebControls.Image>("imgThumbnail");
imgThumbnail.ImageUrl = item.GetArticleThumbnailUrl(230, 129);
FieldRenderer frPageTitle = e.FindControlAs<FieldRenderer>("frPageTitle");
frPageTitle.Item = item;
}
}
示例10: rptAllGroups_ItemDataBound
protected void rptAllGroups_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
//throw new NotImplementedException();
if(e.Item !=null)
{
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
GroupCardModel thisItem = ((GroupCardModel) e.Item.DataItem);
GroupJoinButton joinBtn = e.FindControlAs<GroupJoinButton>("BtnJoin");
if(joinBtn!=null)
{
if(e.Item.DataItem is GroupCardModel)
{
var id = thisItem.GroupID;
joinBtn.LoadState(id);
}
}
if (IsUserLoggedIn && !String.IsNullOrEmpty(CurrentMember.ScreenName))
{
HyperLink hrefImageLink = e.FindControlAs<HyperLink>("hrefImageLink");
if (hrefImageLink != null)
{
hrefImageLink.NavigateUrl = thisItem.GrpItem.GetUrl();
}
HyperLink hrefTitleLink = e.FindControlAs<HyperLink>("hrefTitleLink");
if (hrefImageLink != null)
{
hrefTitleLink.NavigateUrl = thisItem.GrpItem.GetUrl();
}
}
Image imgGroup = e.FindControlAs<Image>("imgGroup");
if(imgGroup!=null)
{
imgGroup.ImageUrl = thisItem.ModeratorAvatarUrl??"http://placehold.it/150x85";
}
Literal litSkipThis = e.FindControlAs<Literal>("litSkipThis");
if(litSkipThis!=null)
{
litSkipThis.Text = DictionaryConstants.SkipThisLabel; //Skip this
}
Literal litMembers = e.FindControlAs<Literal>("litMembers");
if(litMembers!=null)
{
litMembers.Text = thisItem.NumOfMembers + DictionaryConstants.MembersLabel;
}
Literal litDiscussions = e.FindControlAs<Literal>("litDiscussions");
if (litDiscussions != null)
{
litDiscussions.Text = thisItem.NumOfDiscussions + DictionaryConstants.PostsLabel;
}
}
}
}
示例11: rptArticles_ItemDataBound
void rptArticles_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.IsItem())
{
DefaultArticlePageItem item = (DefaultArticlePageItem)e.Item.DataItem;
Sublayout sbArticleEntry = e.FindControlAs<Sublayout>("sbArticleEntry");
sbArticleEntry.DataSource = item.ID.ToString();
}
}
示例12: rptEvents_ItemDataBound
void rptEvents_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.IsItem())
{
BaseEventDetailPageItem item = (BaseEventDetailPageItem)e.Item.DataItem;
Sublayout slEventArchive = e.FindControlAs<Sublayout>("slEventArchive");
slEventArchive.DataSource = item.ID.ToString();
}
}
示例13: rptTryMoreQuizzes_ItemDataBound
protected void rptTryMoreQuizzes_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.IsItem())
{
DefaultArticlePageItem context = (DefaultArticlePageItem)e.Item.DataItem;
System.Web.UI.WebControls.Image imgImage = e.FindControlAs<System.Web.UI.WebControls.Image>("imgImage");
FieldRenderer frQuizName = e.FindControlAs<FieldRenderer>("frQuizName");
HyperLink hypMoreLink = e.FindControlAs<HyperLink>("hypMoreLink");
if (context != null)
{
imgImage.ImageUrl = context.GetArticleThumbnailUrl(230, 129); ;
frQuizName.Item = context.InnerItem;
hypMoreLink.NavigateUrl = context.GetUrl();
}
}
}
示例14: rptTips_ItemDataBound
void rptTips_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.IsItem())
{
BehaviorAdvicePageItem item = (BehaviorAdvicePageItem)e.Item.DataItem;
HyperLink hlTip = e.FindControlAs<HyperLink>("hlTip");
hlTip.NavigateUrl = item.GetUrl();
hlTip.Text = item.TipTitle;
}
}
示例15: rptRecommendationCallouts_ItemDataBound
protected void rptRecommendationCallouts_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.IsItem())
{
ArticleCalloutItem currentCallout = e.Item.DataItem as ArticleCalloutItem;
if (currentCallout != null)
{
FieldRenderer frCalloutNumber = e.FindControlAs<FieldRenderer>("frCalloutNumber");
if (frCalloutNumber != null)
{
frCalloutNumber.Item = currentCallout;
}
FieldRenderer frCalloutDescription = e.FindControlAs<FieldRenderer>("frCalloutDescription");
if (frCalloutDescription != null)
{
frCalloutDescription.Item = currentCallout;
}
}
}
}