当前位置: 首页>>代码示例>>C#>>正文


C# DataListItemEventArgs类代码示例

本文整理汇总了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));
        }
    }
开发者ID:priya-sudarshanam,项目名称:C-Sharp-Experiments,代码行数:31,代码来源:ProductsList.ascx.cs

示例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;
    }
开发者ID:waliul-cse,项目名称:An-Eommerce-website-Development-Project,代码行数:7,代码来源:Default.aspx.cs

示例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);
     }
 }
开发者ID:AdamsChao,项目名称:netdb-localdev-proj,代码行数:8,代码来源:ImaDetailQ.aspx.cs

示例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;

            }
        }
    }
开发者ID:Letractively,项目名称:dilas,代码行数:28,代码来源:_Grade_DefaultTimeTable.aspx.cs

示例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;
                }
            }
        }
    }
开发者ID:foxvirtuous,项目名称:MVB2C,代码行数:33,代码来源:HTLTravelerControl.ascx.cs

示例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;
            }
        }
    }
开发者ID:zjplus,项目名称:phoneSys,代码行数:25,代码来源:GoodsInfo.aspx.cs

示例7: dlFlights_ItemDataBound

    protected void dlFlights_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {

        }
    }
开发者ID:foxvirtuous,项目名称:MVB2C,代码行数:7,代码来源:TourFlightDetailInMailControl.ascx.cs

示例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;
         }
     }
 }
开发者ID:kinggod,项目名称:21SourceCode,代码行数:25,代码来源:UserLogin.aspx.cs

示例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);
     }
 }
开发者ID:smartabbas,项目名称:governmentvideo.com,代码行数:35,代码来源:HomeDepartments.ascx.cs

示例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);
        }
    }
开发者ID:foxvirtuous,项目名称:MVB2C,代码行数:31,代码来源:TourSearchResultForm.aspx.cs

示例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;
 }
开发者ID:getfirstblood,项目名称:course-website,代码行数:7,代码来源:ItemInMark.aspx.cs

示例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";
             }
         }
     }
 }
开发者ID:resh2302,项目名称:BRDHC-BkUp,代码行数:26,代码来源:approveAppointment.aspx.cs

示例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;
 }
开发者ID:dalinhuang,项目名称:learnsite,代码行数:26,代码来源:mysite.aspx.cs

示例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();
        }
    }
开发者ID:guarddoggps,项目名称:xtremek-static,代码行数:33,代码来源:SchemeEdit.ascx.cs

示例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";
            }
        }
    }
开发者ID:kjeans,项目名称:online-shop,代码行数:27,代码来源:Formatting.aspx.cs


注:本文中的DataListItemEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。