绑定

<%#Container.DataItem%>
  string ID = DataBinder.Eval(e.Row.DataItem, "ID").ToString();

1.DataList
  protected void dlImages_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {}
}

2.Repeater
 protected void reptDesc_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {}
}

3.GridView
protected void gridList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
 if (e.Row.RowType == DataControlRowType.DataRow)
            {}
}

你可能感兴趣的:(绑定)