本文整理汇总了C#中System.Web.UI.WebControls.RepeaterItem.FindControl方法的典型用法代码示例。如果您正苦于以下问题:C# RepeaterItem.FindControl方法的具体用法?C# RepeaterItem.FindControl怎么用?C# RepeaterItem.FindControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.RepeaterItem
的用法示例。
在下文中一共展示了RepeaterItem.FindControl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetRowValue
public void SetRowValue(bool otherBreak, int index, string value, Repeater rpt, RepeaterItem item, string controlId, string width)
{
if (this._value == null)
{
Init(index, value);
if (_total == 1)
{
Literal ltr = (Literal)item.FindControl(controlId);
ltr.Text = " <td align=\"center\" style=\"width:" + width + "\">" + _value + "</td>";
}
}
else
{
if (index == _total - 1 || index == _pageSize - 1)
{
if (value != this._value || otherBreak)
{
Literal ltr = (Literal)rpt.Items[_index].FindControl(controlId);
ltr.Text = " <td align=\"center\" style=\"width:" + width + "\"" + (_rowCount > 1 ? " rowspan=" + _rowCount : "") + ">" + _value + "</td>";
ltr = (Literal)item.FindControl(controlId);
ltr.Text = " <td align=\"center\" style=\"width:" + width + "\">" + value + "</td>";
}
else
{
_rowCount++;
Literal ltr = (Literal)rpt.Items[_index].FindControl(controlId);
ltr.Text = " <td align=\"center\" style=\"width:" + width + "\"" + (_rowCount > 1 ? " rowspan=" + _rowCount : "") + ">" + _value + "</td>";
}
}
else
if (value != this._value || otherBreak)
{
Literal ltr = (Literal)rpt.Items[_index].FindControl(controlId);
ltr.Text = " <td align=\"center\" style=\"width:" + width + "\"" + (_rowCount > 1 ? " rowspan=" + _rowCount : "") + ">" + _value + "</td>";
Init(index, value);
}
else
{
_rowCount++;
}
}
}
示例2: BindItemImage
/// <summary>
/// Initialized and set the images size for hovering with javascript
/// </summary>
private void BindItemImage(RepeaterItem item, string folderUrl)
{
System.Web.UI.WebControls.Image itemImage = item.FindControl("ItemImage") as System.Web.UI.WebControls.Image;
string filename = (item.FindControl("FileNameHiddenField") as HiddenField).Value;
// default image
SetImageSize(itemImage, filename, 150, 150, folderUrl);
// large image
//SetImageSize(LargeItemImage, imageUrl, 250, 250);
// add javascript attributes
//itemImage.Attributes.Add("onmouseover", "HighlightImage('ItemImageDiv')");
//itemImage.Attributes.Add("onmouseout", "RemoveImageHighlight('ItemImageDiv')");
//itemImage.Attributes.Add("onclick", "ShowLargeImage('LargeImageDiv')");
}
示例3: SetRowCheckBox
public void SetRowCheckBox(int index, string value, Repeater rpt, RepeaterItem item, string controlId, string checkBoxId)
{
if (this._value == null)
{
Init(index, value);
if (_total == 1)
{
Literal ltr = (Literal)item.FindControl(controlId);
ltr.Text = " <td align=\"center\">" + "";
CheckBox chk = (CheckBox)item.FindControl(checkBoxId);
chk.Visible = chk.Enabled;
}
}
else
{
if (index == _total - 1)
{
if (value != this._value)
{
Literal ltr = (Literal)rpt.Items[_index].FindControl(controlId);
ltr.Text = " <td align=\"center\" " + (_rowCount > 1 ? " rowspan=" + _rowCount : "") + ">" + "";
CheckBox chk = (CheckBox)rpt.Items[_index].FindControl(checkBoxId);
chk.Visible = chk.Enabled;
ltr = (Literal)item.FindControl(controlId);
ltr.Text = " <td align=\"center\">" + "";
chk = (CheckBox)item.FindControl(checkBoxId);
chk.Visible = chk.Enabled;
}
else
{
_rowCount++;
Literal ltr = (Literal)rpt.Items[_index].FindControl(controlId);
ltr.Text = " <td align=\"center\" " + (_rowCount > 1 ? " rowspan=" + _rowCount : "") + ">" + "";
CheckBox chk = (CheckBox)rpt.Items[_index].FindControl(checkBoxId);
chk.Visible = chk.Enabled;
}
}
else
if (value != this._value)
{
Literal ltr = (Literal)rpt.Items[_index].FindControl(controlId);
ltr.Text = " <td align=\"center\" " + (_rowCount > 1 ? " rowspan=" + _rowCount : "") + ">" + "";
CheckBox chk = (CheckBox)rpt.Items[_index].FindControl(checkBoxId);
chk.Visible = chk.Enabled;
Init(index, value);
}
else
{
_rowCount++;
}
}
}
示例4: RaiseRepeaterEvent
/// <summary>
/// Raises the repeater event.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="ev">The ev.</param>
private void RaiseRepeaterEvent(RepeaterItem item, ViewEventHandler ev)
{
this._CurrentGroup = this.GLMinorCategoryActivityGroups[item.ItemIndex];
this._currentMinorCategoriesControl = item.FindControl("MinorCategoryDropDown") as MultiSelectDropDown;
this._currentActivityTypesControl = item.FindControl("ActivityTypeDropDown") as MultiSelectDropDown;
ev();
}
示例5: GetParaCondition
private CategoryConditionModel GetParaCondition(int scenceId, int cateId, RepeaterItem item)
{
CategoryConditionModel ccmodel = null;
Label lblPropName = item.FindControl("lblPropName") as Label;
CheckBoxList cblPara = item.FindControl("cblPara") as CheckBoxList;
List<string> selvals = new List<string>();
foreach (ListItem sitem in cblPara.Items)
{
if (sitem.Selected)
selvals.Add("'" + sitem.Value + "'");
}
if (selvals.Count > 0)
{
string rulvals = String.Join(",", selvals.ToArray());
ccmodel = new CategoryConditionModel(scenceId, cateId, int.Parse(lblPropName.ToolTip), rulvals);
}
return ccmodel;
}
示例6: OnFilterItemCreated
/// <summary>
/// gets called for every item and alternating item template being instantiated by this
/// repeater during databinding
/// </summary>
/// <param name="item"></param>
protected virtual void OnFilterItemCreated(RepeaterItem item) {
var filter = item.FindControl(DynamicFilterContainerId) as FilterUserControlBase;
if (filter == null) {
throw new InvalidOperationException(
String.Format(CultureInfo.CurrentCulture,
DynamicDataResources.FilterRepeater_CouldNotFindControlInTemplate,
ID,
typeof(FilterUserControlBase).FullName,
DynamicFilterContainerId));
}
var column = (MetaColumn)item.DataItem;
filter.TableName = column.Table.Name;
filter.DataField = column.Name;
filter.ContextTypeName = column.Table.DataContextType.AssemblyQualifiedName;
// Keep track of all the filters we create
_filters.Add(filter);
}
示例7: ChangeCallLogRepeaterColumnVisibility
private void ChangeCallLogRepeaterColumnVisibility(RepeaterItem item, string colName, bool visibility)
{
HtmlTableCell cell = (HtmlTableCell)item.FindControl(colName);
if (null != cell) cell.Visible = visibility;
}
示例8: SetControlValueByRepeater
/// <summary>
/// Repeater中FindControl并赋值
/// </summary>
/// <param name="gridViewRow"></param>
/// <param name="controlName"></param>
/// <param name="controlValue"></param>
public static void SetControlValueByRepeater(RepeaterItem item,
string controlName, string controlValue)
{
Control currentControl = (Control)item.FindControl(controlName);
if (currentControl == null)
{
return;
}
if (currentControl is HiddenField)
{
((HiddenField)currentControl).Value = controlValue;
return;
}
if (currentControl is TextBox)
{
((TextBox)currentControl).Text = controlValue;
return;
}
if (currentControl is Label)
{
((Label)currentControl).Text = controlValue;
return;
}
}
示例9: UpdateShoppingCart
protected void UpdateShoppingCart(RepeaterItem rptHeadItem)
{
if (!IsShoppingCart)
return;
ApplyCheckoutAttributes();
bool hasErrors = ValidateCartItems(rptHeadItem);
Repeater rptShoppingCart = (Repeater)rptHeadItem.FindControl("rptShoppingCart");
if (!hasErrors)
{
foreach (RepeaterItem item in rptShoppingCart.Items)
{
var txtQuantity = item.FindControl("txtQuantity") as TextBox;
var lblShoppingCartItemId = item.FindControl("lblShoppingCartItemId") as Label;
var cbRemoveFromCart = item.FindControl("cbRemoveFromCart") as CheckBox;
int shoppingCartItemId = 0;
int quantity = 0;
if (txtQuantity != null && lblShoppingCartItemId != null && cbRemoveFromCart != null)
{
int.TryParse(lblShoppingCartItemId.Text, out shoppingCartItemId);
if (cbRemoveFromCart.Checked)
{
this.ShoppingCartService.DeleteShoppingCartItem(shoppingCartItemId, true);
}
else
{
int.TryParse(txtQuantity.Text, out quantity);
List<string> addToCartWarning = this.ShoppingCartService.UpdateCart(shoppingCartItemId, quantity, true);
}
}
}
Response.Redirect(SEOHelper.GetShoppingCartUrl());
}
}
示例10: GetImageUrlByRepeater
/// <summary>
/// 在Repeater Item中找Image的url
/// </summary>
/// <param name="item"></param>
/// <param name="controlName"></param>
/// <returns></returns>
public static string GetImageUrlByRepeater(RepeaterItem item, string controlName)
{
Image image = ((Image)item.FindControl(controlName));
if (image != null)
{
return image.ImageUrl;
}
return string.Empty;
}
示例11: GetHiddenValueByRepeater
/// <summary>
/// 在Repeater中找Hidden字段值
/// </summary>
/// <param name="item"></param>
/// <param name="controlName"></param>
/// <returns></returns>
public static string GetHiddenValueByRepeater(RepeaterItem item, string controlName)
{
HiddenField hdControl = (HiddenField)item.FindControl(controlName);
if (hdControl != null && !string.IsNullOrEmpty(hdControl.Value))
{
return hdControl.Value;
}
return string.Empty;
}
示例12: GetLabelValueByRepeater
/// <summary>
/// 在Repeater Item中找Label值
/// </summary>
/// <param name="item"></param>
/// <param name="controlName"></param>
/// <returns></returns>
public static string GetLabelValueByRepeater(RepeaterItem item, string controlName)
{
Label label = ((Label)item.FindControl(controlName));
if (label != null)
{
return label.Text;
}
return string.Empty;
}
示例13: GetTextBoxValueByRepeater
/// <summary>
/// 在Repeater Item中找TextBox值
/// </summary>
/// <param name="item"></param>
/// <param name="controlName"></param>
/// <returns></returns>
public static string GetTextBoxValueByRepeater(RepeaterItem item, string controlName)
{
TextBox textBox = ((TextBox)item.FindControl(controlName));
if (textBox != null)
{
return textBox.Text;
}
return string.Empty;
}
示例14: AdicionarDespesasDeTodosOsMeses
private void AdicionarDespesasDeTodosOsMeses(List<DespesaDeViagemDTO> despesasDeViagemDto, RepeaterItem valoresTotaisItem)
{
var despesaDeViagemDto = new DespesaDeViagemDTO();
var rptContas = (Repeater)valoresTotaisItem.FindControl("rptContas");
AdicionarDespesasMesAMes(despesaDeViagemDto, rptContas);
despesasDeViagemDto.Add(despesaDeViagemDto);
}
示例15: BindItemImage
//public void BindItemImageManually()
//{
// ItemRepeaterPlaceHolder.Visible = true;
// SavePlaceHolder.Visible = false;
// BindItemImage();
//}
/// <summary>
/// Initialized and set the images size for hovering with javascript
/// </summary>
private void BindItemImage(RepeaterItem item)
{
if (string.IsNullOrEmpty(ItemID))
return;
System.Web.UI.WebControls.Image itemImage = item.FindControl("ItemImage") as System.Web.UI.WebControls.Image;
string filename = (item.FindControl("FileNameHiddenField") as HiddenField).Value;
string filesize = (item.FindControl("FileSizeHiddenField") as HiddenField).Value;
string priority = (item.FindControl("PriorityHiddenField") as HiddenField).Value;
itemImage.AlternateText = itemImage.ToolTip = "namn: " + filename + "\nstorlek: " + FileHelper.ConvertSizeToKBOrMBOrGBOrTB(filesize) + "\nprioritet: " + priority;
// default image
SetImageSize(itemImage, filename, 150, 150);
// large image
//SetImageSize(LargeItemImage, imageUrl, 250, 250);
// add javascript attributes
//itemImage.Attributes.Add("onmouseover", "HighlightImage('ItemImageDiv')");
//itemImage.Attributes.Add("onmouseout", "RemoveImageHighlight('ItemImageDiv')");
//itemImage.Attributes.Add("onclick", "ShowLargeImage('LargeImageDiv')");
}