本文整理汇总了C#中System.Web.UI.WebControls.Repeater类的典型用法代码示例。如果您正苦于以下问题:C# Repeater类的具体用法?C# Repeater怎么用?C# Repeater使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Repeater类属于System.Web.UI.WebControls命名空间,在下文中一共展示了Repeater类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindRepeaterWithPaging
public static PagedDataSource BindRepeaterWithPaging(ref Repeater objRepeater, int currentPage, string strSelectQuery, string strSearchCondition = "", string strAddNewRow = "")
{
//create new instance of PagedDataSource
PagedDataSource objPds = new PagedDataSource();
DataSet dsBindData = new DataSet();
DataView dv = new DataView();
//set number of pages will appear
objPds.PageSize = csGlobal.pageSize;
objPds.AllowPaging = true;
//Fill DataSet And Create Dataview
dsBindData = CrystalConnection.CreateDatasetWithoutTransaction(strSelectQuery);
dv = dsBindData.Tables[0].DefaultView;
//Filter the DataView According to Search Condition
if (strSearchCondition != "")
{
dv.RowFilter = strSearchCondition;
}
objPds.DataSource = dv;
//Setting CurrentPageIndex, Which page is to be set Current Page
if (strAddNewRow == "")
objPds.CurrentPageIndex = currentPage;
else
objPds.CurrentPageIndex = objPds.PageCount - 1;
//Bind the Repeader with PageDataSource
objRepeater.DataSource = objPds;
objRepeater.DataBind();
return objPds;
}
示例2: btnDelete_Click
//批量删除
protected void btnDelete_Click(object sender, EventArgs e)
{
int sucCount = 0; //成功数量
int errorCount = 0; //失败数量
Repeater rptList = new Repeater();
rptList = this.rptList1;
for (int i = 0; i < rptList.Items.Count; i++)
{
int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
if (cb.Checked)
{
if (bll.Delete(id))
{
sucCount++;
}
else
{
errorCount++;
}
}
}
AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "删除lbs数据管理内容成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("lbslist.aspx", "keywords={0}", this.keywords), "Success");
}
示例3: BindCourseware
public void BindCourseware()
{
var repeaters = new Repeater[]
{A0, A1, A2, A3, A4, A5, A6, B0, B1, B2, B3, B4, B5, B6, C0, C1, C2, C3, C4, C5, C6};
foreach (var repeater in repeaters)
{
Func<ResourceMap, bool> funcWhere;
Func<ResourceMap, dynamic> funcOrder;
var index = int.Parse(repeater.ID.Substring(1, 1));
var order = repeater.ID.Substring(0, 1);
switch (order)
{
case "A":
funcOrder = o => o.Time;
break;
case "B":
funcOrder = o => o.View;
break;
default:
funcOrder = o => o.Credit;
break;
}
funcWhere =
o => o.Type == ResourceType.课件 && o.State < State.审核 && o.CatalogId == Courses[index];
repeater.DataSource = HomoryContext.Value.ResourceMap.Where(predicate: funcWhere).OrderByDescending(funcOrder).Take(10).ToList();
repeater.DataBind();
}
}
示例4: UpdateProfile
public void UpdateProfile(Repeater rpData, Boolean debugMode = false)
{
const string profileupload = "NBStore\\profileupload";
Utils.CreateFolder(PortalSettings.Current.HomeDirectoryMapPath + profileupload);
var strXml = GenXmlFunctions.GetGenXml(rpData, "", PortalSettings.Current.HomeDirectoryMapPath + profileupload);
Save(strXml, debugMode);
}
示例5: btnDelete_Click
//批量删除
protected void btnDelete_Click(object sender, EventArgs e)
{
ChkAdminLevel("weixin_sq", MXEnums.ActionEnum.Delete.ToString()); //检查权限
int sucCount = 0; //成功数量
int errorCount = 0; //失败数量
Repeater rptList = new Repeater();
rptList = this.rptList;
for (int i = 0; i < rptList.Items.Count; i++)
{
int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
if (cb.Checked)
{
if (bll.Delete(id))
{
sucCount++;
}
else
{
errorCount++;
}
}
}
AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "删除微信上墙图片成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
Response.Redirect(Utils.CombUrlTxt("photo_list.aspx", "id={0}&keywords={1}",
aid.ToString(), this.keywords));
}
示例6: 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
{
}
}
示例7: GetCheckBoxByRepeater
/// <summary>
/// 获得Repeater中已选的CheckBox值集合
/// </summary>
/// <param name="list">列表控件</param>
/// <param name="checkId">CheckBox名称</param>
/// <returns></returns>
public static string GetCheckBoxByRepeater(Repeater list, string checkId)
{
if (list == null)
{
throw new ArgumentNullException("list");
}
StringBuilder rets = new StringBuilder();
for (int i = 0; i < list.Items.Count; i++)
{
CheckBox check = (CheckBox) list.Items[i].FindControl(checkId);
if (check.Checked)
{
if (rets.Length > 0)
{
rets.Append(",");
rets.Append(check.Text);
}
else
{
rets.Append(check.Text);
}
}
}
return rets.ToString();
}
示例8: 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);
}
}
}
});
}
示例9: 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 { lblMsg.Text = "Nội dung đang được cập nhật!"; }
}
catch (Exception)
{
throw;
}
}
示例10: btnSave_Click
//保存排序
protected void btnSave_Click(object sender, EventArgs e)
{
ChkAdminLevel("channel_" + this.channel_name + "_list", DTEnums.ActionEnum.Edit.ToString()); //检查权限
BLL.article bll = new BLL.article();
Repeater rptList = new Repeater();
switch (this.prolistview)
{
case "Txt":
rptList = this.rptList1;
break;
default:
rptList = this.rptList2;
break;
}
for (int i = 0; i < rptList.Items.Count; i++)
{
int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
int sortId;
if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
{
sortId = 99;
}
bll.UpdateField(id, "sort_id=" + sortId.ToString());
}
AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "保存" + this.channel_name + "频道内容排序"); //记录日志
JscriptMsg("保存排序成功啦!", Utils.CombUrlTxt("article_list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}",
this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success");
}
示例11: btnAudit_Click
//批量审核
protected void btnAudit_Click(object sender, EventArgs e)
{
ChkAdminLevel("channel_" + this.channel_name + "_list", DTEnums.ActionEnum.Audit.ToString()); //检查权限
BLL.article bll = new BLL.article();
Repeater rptList = new Repeater();
switch (this.prolistview)
{
case "Txt":
rptList = this.rptList1;
break;
default:
rptList = this.rptList2;
break;
}
for (int i = 0; i < rptList.Items.Count; i++)
{
int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
if (cb.Checked)
{
bll.UpdateField(id, "status=0");
}
}
AddAdminLog(DTEnums.ActionEnum.Audit.ToString(), "审核" + this.channel_name + "频道内容信息"); //记录日志
JscriptMsg("批量审核成功!", Utils.CombUrlTxt("article_list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}",
this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property));
}
示例12: btnDelete_Click
//批量删除
protected void btnDelete_Click(object sender, EventArgs e)
{
ChkAdminLevel("channel_" + this.channel_name + "_list", MXEnums.ActionEnum.Delete.ToString()); //检查权限
int sucCount = 0; //成功数量
int errorCount = 0; //失败数量
BLL.article bll = new BLL.article();
Repeater rptList = new Repeater();
rptList = this.rptList1;
for (int i = 0; i < rptList.Items.Count; i++)
{
int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
if (cb.Checked)
{
if (bll.Delete(id))
{
sucCount++;
}
else
{
errorCount++;
}
}
}
AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "删除" + this.channel_name + "单页内容成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("article_page_list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}",
this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success");
}
示例13: btnDelete_Click
//批量删除
protected void btnDelete_Click(object sender, EventArgs e)
{
ChkAdminLevel("link", OSEnums.ActionEnum.Delete.ToString()); //检查权限
int sucCount = 0; //成功数量
int errorCount = 0; //失败数量
BLL.contents.article bll = new BLL.contents.article();
Repeater rptList = new Repeater();
rptList = this.rptList1;
for (int i = 0; i < rptList.Items.Count; i++)
{
int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
if (cb.Checked)
{
if (bll.Delete(id))
{
sucCount++;
}
else
{
errorCount++;
}
}
}
AddAdminLog(OSEnums.ActionEnum.Edit.ToString(), "删除[搜索-"+this.keywords+"]频道内容成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
Response.Redirect(Utils.CombUrlTxt("search.aspx", "keywords={0}", this.keywords));
}
示例14: InitializeSkin
protected override void InitializeSkin(System.Web.UI.Control Skin)
{
Repeater1 = (Repeater)Skin.FindControl("Repeater1");
Button1 = (Button)Skin.FindControl("Button1");
Button1.Click += new EventHandler(Button1_Click);
DataBind();
}
示例15: btnSave_Click
//保存排序
protected void btnSave_Click(object sender, EventArgs e)
{
BLL.goods bll = new BLL.goods();
Repeater rptList = new Repeater();
switch (this.prolistview)
{
case "Txt":
rptList = this.rptList1;
break;
default:
rptList = this.rptList2;
break;
}
for (int i = 0; i < rptList.Items.Count; i++)
{
int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
int sortId;
if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
{
sortId = 99;
}
bll.UpdateField(id, "sort_id=" + sortId.ToString());
}
JscriptMsg("保存排序成功啦!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}",
this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success");
}