本文整理汇总了C#中System.Web.UI.WebControls.Repeater.DataBind方法的典型用法代码示例。如果您正苦于以下问题:C# Repeater.DataBind方法的具体用法?C# Repeater.DataBind怎么用?C# Repeater.DataBind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.Repeater
的用法示例。
在下文中一共展示了Repeater.DataBind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Loadlist
public void Loadlist(Repeater rpt)
{
try
{
int sotin = (_typecat == 0 ? lnews.Getsotin(_Catid) : 100);
var list = lnews.Load_listnews(_Catid);
if (list.Count > 0)
{
if (_page != 0)
{
rpt.DataSource = list.Skip(sotin * _page - sotin).Take(sotin);
rpt.DataBind();
}
else
{
rpt.DataSource = list.Take(sotin);
rpt.DataBind();
}
ltrPage.Text = change.result(list.Count, sotin, _cat_seo_url, 0, _page, 1);
}
else { }
}
catch (Exception)
{
throw;
}
}
示例2: BindMenu
/// <summary>
/// BindMenu
/// </summary>
/// <param name="web"></param>
/// <param name="listName"></param>
/// <param name="rptMenu"></param>
/// <param name="menuPosition"></param>
/// <param name="menuParent"></param>
public static void BindMenu(SPWeb web, string listName, Repeater rptMenu, string menuPosition, string menuParent)
{
SPSecurity.RunWithElevatedPrivileges(() =>
{
using (var adminSite = new SPSite(web.Site.ID))
{
using (var adminWeb = adminSite.OpenWeb(web.ID))
{
try
{
adminWeb.AllowUnsafeUpdates = true;
string caml = @"<Where><And><Eq><FieldRef Name='{0}' /><Value Type='Text'>{1}</Value></Eq><Eq><FieldRef Name='{2}' /><Value Type='MultiChoice'>{3}</Value></Eq></And></Where><OrderBy><FieldRef Name='{4}' /></OrderBy>";
var query = new SPQuery()
{
Query = string.Format(CultureInfo.InvariantCulture, caml, FieldsName.MenuList.InternalName.ParentID, menuParent, FieldsName.MenuList.InternalName.MenuPosition, menuPosition, FieldsName.MenuList.InternalName.MenuOrder)
};
var list = Utilities.GetCustomListByUrl(adminWeb, listName);
var items = list.GetItems(query);
if (items != null && items.Count > 0)
{
rptMenu.DataSource = items.GetDataTable();
rptMenu.DataBind();
}
}
catch (SPException ex)
{
Utilities.LogToULS(ex);
}
}
}
});
}
示例3: BindDataToControls
public void BindDataToControls(Repeater tasksList, Repeater performersList)
{
tasksList.DataSource = _tasksService.GetRecentTasks(5);
performersList.DataSource = _employeService.GetTopPerformers(5);
tasksList.DataBind();
performersList.DataBind();
}
示例4: DoDetail
/// <summary>
/// Display template with moduleid set
/// </summary>
/// <param name="rp1"></param>
/// <param name="moduleId"></param>
public void DoDetail(Repeater rp1,int moduleId)
{
var obj = new NBrightInfo(true);
obj.ModuleId = moduleId;
var l = new List<object> { obj };
rp1.DataSource = l;
rp1.DataBind();
}
示例5: InitializeSkin
protected override void InitializeSkin(System.Web.UI.Control Skin)
{
CommentRepeater = (Repeater)Skin.FindControl("NewComment");
//CommentRepeater.DataSource = BView_WeblogUserComment.GetTopCommentByLogUID(blogContext.BlogUserId);
CommentRepeater.DataSource = BGetCommentInfoByLogId.GetTopCommentByLogUID(blogContext.BlogUserId);
CommentRepeater.DataBind();
//throw new NotImplementedException();
}
示例6: InitMetadataRepeater
/// <summary>
/// Inits the metadata repeater.
/// </summary>
/// <param name="pageMetadata">The page metadata.</param>
/// <param name="metadataTypeName">Name of the metadata type.</param>
/// <param name="repeater">The repeater.</param>
protected void InitMetadataRepeater(List<Metadata> pageMetadata, string metadataTypeName, Repeater repeater)
{
QueryRequest queryRequestFactory = QueryRequestFactory.Instance.GetMetadataSubjectInstancesQueryRequest(ModuleCMS.Instance.PageTypes, FoundationContext.Current.LanguageID, FoundationContext.Current.Token);
List<App_Code.Site.CMS.MetaData.Metadata> metadatas = MetadataService.Instance.GetMetadatas(queryRequestFactory, ModuleCMS.Instance.PermissionManager,FoundationContext.Current.Token);
repeater.DataSource = metadatas;
repeater.DataBind();
}
示例7: AttachChildControls
protected override void AttachChildControls()
{
rp_productsales = (Repeater)this.FindControl("rp_productsales");
DataTable lineItems = ProductBrowser.GetLineItems(Convert.ToInt32(this.Page.Request.QueryString["productId"]), this.maxNum);
rp_productsales.DataSource = lineItems;
rp_productsales.DataBind();
}
示例8: read
public void read(String instr, Repeater repeater)
{
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = instr;
cmd.Connection = conn;
repeater.DataSource = cmd.ExecuteReader();
repeater.DataBind();
conn.Close();
}
示例9: bingRepearter
void bingRepearter(string rootID, Repeater rMenu)
{
TreeNodeInfo<MenuInfo> cList = new BLL.Menu().GetTree(rootID);
if (null == cList)
{
return;
}
rMenu.DataSource = cList.ChildNodeList;
rMenu.DataBind();
}
示例10: BindRepeater
public static void BindRepeater(ref Repeater objRepeater, string strSelectQuery)
{
DataSet dsBindData = new DataSet();
DataView dv = new DataView();
//Fill DataSet And Create Dataview
dsBindData = CrystalConnection.CreateDatasetWithoutTransaction(strSelectQuery);
dv = dsBindData.Tables[0].DefaultView;
//Bind the Repeader with PageDataSource
objRepeater.DataSource = dv;
objRepeater.DataBind();
}
示例11: Loadcate_index
public void Loadcate_index(int limit, int type, ref Repeater rp)
{
try
{
rp.DataSource = index.Load_cate_index(limit, type,0);
rp.DataBind();
}
catch (Exception)
{
throw;
}
}
示例12: CreateRepeater
private static void CreateRepeater(Control parent)
{
Control cellContainer = PrepareCellContainer(parent);
Repeater repeater = new Repeater();
cellContainer.Controls.Add(repeater);
repeater.HeaderTemplate = new RepeaterHeaderTemplate();
repeater.ItemTemplate = new RepeaterItemTemplate();
repeater.DataSource = TestData.PrepareData();
repeater.DataBind();
}
示例13: Categories
public static bool? Categories(Repeater userControl, string getstr)
{
if (string.IsNullOrEmpty(getstr))
{
return null;
}
SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand("select discipline_id from discipline where Discipline_name = @name", con);
cmd.Parameters.AddWithValue("name", getstr);
try
{
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
string str = "";
while (dr.Read())
{
str = dr["discipline_id"].ToString();
if (!string.IsNullOrEmpty(str))
break;
}
dr.Close();
SqlCommand cm = new SqlCommand("select categories_name from categories where discipline_id = @id", con);
cm.Parameters.AddWithValue("id", str);
dr = cm.ExecuteReader();
if (dr.HasRows)
{
SqlDataSource ds = new SqlDataSource(WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString, cm.CommandText);
ds.SelectParameters.Add("id", str);
userControl.DataSource = ds;
userControl.DataBind();
return true;
}
}
return false;
}
catch (Exception)
{
return false;
}
finally
{
con.Close();
}
}
示例14: Load_ads
public void Load_ads(int position, ref Repeater rp)
{
try
{
var list = per.Load_slider(position, 1).ToList();
if (list.Count > 0)
{
rp.DataSource = list;
rp.DataBind();
}
}
catch (Exception ex)
{
clsVproErrorHandler.HandlerError(ex);
}
}
示例15: Load_ads
public void Load_ads(int position, ref Repeater rp)
{
try
{
var list = per.Load_slider(HttpContext.Current.Session["Cat_id"], position, 100).ToList();
if (list.Count > 0)
{
rp.DataSource = list;
rp.DataBind();
}
}
catch (Exception ex)
{
clsVproErrorHandler.HandlerError(ex);
}
}