本文整理汇总了C#中DataListItemEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# DataListItemEventArgs类的具体用法?C# DataListItemEventArgs怎么用?C# DataListItemEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataListItemEventArgs类属于命名空间,在下文中一共展示了DataListItemEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: list_ItemDataBound
protected void list_ItemDataBound(object sender, DataListItemEventArgs e)
{
DataRowView dataRow = (DataRowView)e.Item.DataItem;
string productId = dataRow["ProductID"].ToString();
DataTable attrTable = CatalogAccess.GetProductAttributes(productId);
string prevAttributeName = "";
string attributeName, attributeValue, attributeValueId;
Label attributeNameLabel;
PlaceHolder attrPlaceHolder = (PlaceHolder)e.Item.FindControl("attrPlaceHolder");
DropDownList attributeValuesDropDown = new DropDownList();
foreach (DataRow r in attrTable.Rows)
{
attributeName = r["AttributeName"].ToString();
attributeValue = r["AttributeValue"].ToString();
attributeValueId = r["AttributeValueID"].ToString();
if (attributeName != prevAttributeName)
{
prevAttributeName = attributeName;
attributeNameLabel = new Label();
attributeNameLabel.Text = attributeName + ": ";
attributeValuesDropDown = new DropDownList();
attrPlaceHolder.Controls.Add(attributeNameLabel);
attrPlaceHolder.Controls.Add(attributeValuesDropDown);
}
attributeValuesDropDown.Items.Add(new ListItem(attributeValue, attributeValueId));
}
}
示例2: datListGeneral_ItemDataBound
protected void datListGeneral_ItemDataBound(object sender, DataListItemEventArgs e)
{
Label lblImage = e.Item.FindControl("lblImage") as Label;
Image imgPicture = e.Item.FindControl("imgPicture") as Image;
imgPicture.ImageUrl = "~/Uploads/" + lblImage.Text;
}
示例3: dlContact_ItemDataBound
//Contact 替換關鍵字查詢的顏色
protected void dlContact_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
new IMAUtil().RepKW(e.Item.Controls);
}
}
示例4: DataList1_ItemDataBound
protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.EditItem)
{
DropDownList ddlGradeCourseSubject = (DropDownList)e.Item.FindControl("ddlGradeCourseSubject");
ddlGradeCourseSubject.DataTextField = "CourseSubjectName";
ddlGradeCourseSubject.DataValueField = "id";
DataTable dt = (DataTable)ViewState["CourseByGrade"];
ddlGradeCourseSubject.DataSource = dt;
ddlGradeCourseSubject.DataBind();
DataRowView row = (DataRowView)e.Item.DataItem; //取得繫節過來那一筆DataRow
if (!string.IsNullOrEmpty(row["GradeCourseSubjectID"].ToString()))
{
ddlGradeCourseSubject.SelectedValue = row["GradeCourseSubjectID"].ToString();
}
}
if(e.Item.ItemType== ListItemType.Item || e.Item.ItemType== ListItemType.AlternatingItem)
{
Person myPerson = new Person();
if (myPerson.Role == Person.LoginRole.Administrator)
{
Panel addPan = (Panel)e.Item.FindControl("addPan");
addPan.Visible = false;
}
}
}
示例5: dlPassengers_ItemDataBound
protected void dlPassengers_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType != ListItemType.Footer && e.Item.ItemType != ListItemType.Header)
{
Label lbl = (Label)e.Item.FindControl("Label3");
if (lbl.Text.Trim() == "0".Trim())
{
lbl.Text = "Mr";
}
if (lbl.Text.Trim() == "1".Trim())
{
lbl.Text = "Mrs";
}
if (lbl.Text.Trim() == "2".Trim())
{
lbl.Text = "Ms";
}
if (((Label)e.Item.FindControl("lbBirth")).Text.Trim() != "")
{
DateTime birthDay = Convert.ToDateTime(((Label)e.Item.FindControl("lbBirth")).Text);
if (IsDateTimeCurrent(birthDay))
{
((Label)e.Item.FindControl("lbBirth")).Visible = true;
((Label)e.Item.FindControl("lbBirth")).Text = Convert.ToDateTime(((Label)e.Item.FindControl("lbBirth")).Text).ToString("MM/dd/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo);
}
else
{
((Label)e.Item.FindControl("lbBirth")).Visible = false;
}
}
}
}
示例6: dlEstimate_ItemDataBound
protected void dlEstimate_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Footer)
{
Label lblCurrent = e.Item.FindControl("lblCurrentPage") as Label;
Label lblCount = e.Item.FindControl("lblCount") as Label;
LinkButton lbtnFirst = e.Item.FindControl("lbtnFirst") as LinkButton;
LinkButton lbtnPre = e.Item.FindControl("lbtnPre") as LinkButton;
LinkButton lbtnNext = e.Item.FindControl("lbtnNext") as LinkButton;
LinkButton lbtnLast = e.Item.FindControl("lbtnLast") as LinkButton;
lblCurrent.Text = "第" + (pds.CurrentPageIndex + 1).ToString() + "页";
lblCount.Text = "共" + pds.PageCount.ToString() + "页";
if (pds.IsFirstPage)
{
lbtnFirst.Enabled = false;
lbtnPre.Enabled = false;
}
if (pds.IsLastPage)
{
lbtnNext.Enabled = false;
lbtnLast.Enabled = false;
}
}
}
示例7: dlFlights_ItemDataBound
protected void dlFlights_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
}
}
示例8: dlPictrue_ItemDataBound
protected void dlPictrue_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Footer)
{
//以下六个为得到脚模板中的控件,并创建变量.
Label CurrentPage = e.Item.FindControl("labCurrentPage") as Label;
Label PageCount = e.Item.FindControl("labPageCount") as Label;
LinkButton FirstPage = e.Item.FindControl("lnkbtnFirst") as LinkButton;
LinkButton PrePage = e.Item.FindControl("lnkbtnFront") as LinkButton;
LinkButton NextPage = e.Item.FindControl("lnkbtnNext") as LinkButton;
LinkButton LastPage = e.Item.FindControl("lnkbtnLast") as LinkButton;
CurrentPage.Text = (pds.CurrentPageIndex + 1).ToString();//绑定显示当前页
PageCount.Text = pds.PageCount.ToString();//绑定显示总页数
if (pds.IsFirstPage)//如果是第一页,首页和上一页不能用
{
FirstPage.Enabled = false;
PrePage.Enabled = false;
}
if (pds.IsLastPage)//如果是最后一页"下一页"和"尾页"按钮不能用
{
NextPage.Enabled = false;
LastPage.Enabled = false;
}
}
}
示例9: rptDataBound
protected void rptDataBound(object sender, DataListItemEventArgs e)
{
try
{
string str = Server.HtmlDecode(ds.Tables[0].Rows[e.Item.ItemIndex]["Article"].ToString());
Match m = Regex.Match(str, @"<img(.|\n)+?>");
Image ArticleImage = (Image)e.Item.FindControl("img");
if (!string.IsNullOrEmpty(ds.Tables[0].Rows[e.Item.ItemIndex]["Thumbnail"].ToString()))
{
System.Drawing.Bitmap bmp = customTransactions.RezizeImage(Server.MapPath(ds.Tables[0].Rows[e.Item.ItemIndex]["Thumbnail"].ToString()), 110, 80, ArticleImage);
ArticleImage.ImageUrl = ds.Tables[0].Rows[e.Item.ItemIndex]["Thumbnail"].ToString();
}
else if (m.Success)
{
Match inner = Regex.Match(m.Value, "src=[\'|\"](.+?)[\'|\"]");
if (inner.Success)
{
string imageurl = inner.Value.Substring(5).Substring(0, inner.Value.Substring(5).LastIndexOf("\""));
System.Drawing.Bitmap bmp = customTransactions.RezizeImage(Server.MapPath(imageurl), 110, 80, ArticleImage);
ArticleImage.ImageUrl = inner.Value.Substring(5).Substring(0, inner.Value.Substring(5).LastIndexOf("\""));
}
}
}
catch (Exception ex)
{
UserInfo info = UserController.GetCurrentUserInfo();
ErrorLog objLog = new ErrorLog();
objLog.ErrorDescription = ex.ToString();
objLog.ErrorDate = DateTime.Now;
objLog.ErrorFunctionName = "Page Load";
objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1));
objLog.ErrorLoggedInUser = info.Username;
objLog.AddErrorToLog(objLog);
}
}
示例10: dlTourProduct_ItemDataBound
protected void dlTourProduct_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Label lbl_HasAir = (Label)e.Item.FindControl("lbl_HasAir");
Label lbl_DeptFrom = (Label)e.Item.FindControl("lbl_DeptFrom");
Label lbl_Disp = (Label)e.Item.FindControl("lblDisp");
Label lbl_PriceValue = (Label)e.Item.FindControl("lbl_PriceValue");
HtmlTableRow trIsShowAirline = (HtmlTableRow)e.Item.FindControl("trIsShowAirline");
TourMaterial tourMaterial= (TourMaterial)(((System.Object)(((System.Web.UI.WebControls.DataListItem)(e.Item)).DataItem)));
//lbl_PriceValue.Text = ((TourProfile)tourMaterial.Profile)..
if (((TourSearchCondition)this.Transaction.CurrentSearchConditions).IsLandOnly)
{
lbl_HasAir.Visible = lbl_DeptFrom.Visible = lbl_Disp.Visible = false;
lbl_PriceValue.Text = ((Terms.Product.Business.MVTourProfile)tourMaterial.Profile).StartFromLandOnlyFare.ToString("n", System.Globalization.CultureInfo.CurrentUICulture.NumberFormat);
trIsShowAirline.Visible = false;
}
else
{
lbl_DeptFrom.Text = ((Terms.Product.Business.MVTourProfile)tourMaterial.Profile).DefaultDepartureCity.Name + ")";
lbl_PriceValue.Text = ((Terms.Product.Business.MVTourProfile)tourMaterial.Profile).StartFromAirLandFare.ToString("n", System.Globalization.CultureInfo.CurrentUICulture.NumberFormat);
}
//if (((TourProfile)tourMaterial.Profile).Airlines.Count==0)
// trIsShowAirline.Visible=false;
Image img = (Image)e.Item.FindControl("imgTour");
img.ImageUrl = img.ImageUrl.ToString().Replace("~/", string.Empty);
}
}
示例11: DataList1_ItemDataBound
protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{
int nCount = e.Item.ItemIndex + 1;
String str = "第"+nCount.ToString()+"题:";
Label lbl = (Label)e.Item.FindControl("Label4");
lbl.Text = str;
}
示例12: dlApp_ItemDataBound
// method to select status radio button according to approvalSatatus in the table
protected void dlApp_ItemDataBound(object sender, DataListItemEventArgs e)
{
foreach (DataListItem item in dlApp.Items)
{
if (item.ItemType == ListItemType.Item)
{
HiddenField hdfStatus = (HiddenField)e.Item.FindControl("hdfStatus");
if (hdfStatus.Value == "Pending")
{
RadioButtonList rbApprove = (RadioButtonList)e.Item.FindControl("rbApprove");
rbApprove.SelectedValue = "Pending";
}
else if (hdfStatus.Value == "Accepted")
{
RadioButtonList rbApprove = (RadioButtonList)e.Item.FindControl("rbApprove");
rbApprove.SelectedValue = "Accept";
}
else if (hdfStatus.Value == "Rejected")
{
RadioButtonList rbApprove = (RadioButtonList)e.Item.FindControl("rbApprove");
rbApprove.SelectedValue = "Reject";
}
}
}
}
示例13: DataListvote_ItemDataBound
protected void DataListvote_ItemDataBound(object sender, DataListItemEventArgs e)
{
bool webvotelimit = LearnSite.Common.XmlHelp.WebVote_Limit();
string wdate = ((Label)e.Item.FindControl("LabelWupdate")).Text;
if (wdate != "")
{
string nowday = DateTime.Now.ToShortDateString();
DateTime nowdayDt = Convert.ToDateTime(nowday);
DateTime updateDt = Convert.ToDateTime(wdate);
if (updateDt > nowdayDt)
{
((LinkButton)e.Item.FindControl("Linkvote")).BackColor = Lbc.BackColor;
}
}
if (!webvotelimit)
{
((LinkButton)e.Item.FindControl("Linkvote")).Enabled = true;
}
else
{
((LinkButton)e.Item.FindControl("Linkvote")).Enabled = false;
Labelmsg.Text = "现在还不可以进行网站投票,请努力制作好你的网站吧!";
}
string mystr = "网站现评价得分为:" + ((Label)e.Item.FindControl("LabelWscore")).Text + "分";
((HyperLink)e.Item.FindControl("Hypername")).ToolTip = mystr;
}
示例14: _dlstPages_ItemDataBound
protected void _dlstPages_ItemDataBound(object sender, DataListItemEventArgs e)
{
try
{
if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
{
string _insStatus = ((Label)e.Item.FindControl("_lblInsertStatus")).Text;
if (_insStatus == "1")
((CheckBox)e.Item.FindControl("_chkInsert")).Checked = true;
string _viewStatus = ((Label)e.Item.FindControl("_lblViewStatus")).Text;
if (_viewStatus == "1")
((CheckBox)e.Item.FindControl("_chkView")).Checked = true;
string _editStatus = ((Label)e.Item.FindControl("_lblEditStatus")).Text;
if (_editStatus == "1")
((CheckBox)e.Item.FindControl("_chkEdit")).Checked = true;
string _deleteStatus = ((Label)e.Item.FindControl("_lblDeleteStatus")).Text;
if (_deleteStatus == "1")
((CheckBox)e.Item.FindControl("_chkDelete")).Checked = true;
string _status = ((Label)e.Item.FindControl("_lblStatus")).Text;
if (_status == "1")
((CheckBox)e.Item.FindControl("_chkPage")).Checked = true;
}
}
catch (Exception ex)
{
ex.Message.ToString();
}
}
示例15: ItemDataBoundFormattingExample_ItemDataBound
protected void ItemDataBoundFormattingExample_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
// Programmatically reference the ProductsRow instance bound to this DataListItem
Northwind.ProductsRow product = (Northwind.ProductsRow)((System.Data.DataRowView)e.Item.DataItem).Row;
// See if the UnitPrice is not NULL and less than $20.00
if (!product.IsUnitPriceNull() && product.UnitPrice < 20)
{
// Highlight the product name and unit price Labels
// First, get a reference to the two Label Web controls
Label ProductNameLabel = (Label)e.Item.FindControl("ProductNameLabel");
Label UnitPriceLabel = (Label)e.Item.FindControl("UnitPriceLabel");
// Next, set their CssClass properties
if (ProductNameLabel != null)
ProductNameLabel.CssClass = "AffordablePriceEmphasis";
if (UnitPriceLabel != null)
UnitPriceLabel.CssClass = "AffordablePriceEmphasis";
// Alternatively, you can opt to adjust the style for the *entire* item:
// e.Item.CssClass = "AffordablePriceEmphasis";
}
}
}