Repeater完全取代GridVeiw指定类型绑定,分页,隔行样式,Css,合并单元格

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
OnItemCreated="RepReport_ItemCreated">

















序号

工号


<%#Info["WorkNo"] %>










总共个记录



AlwaysShow="True" PageSize="1" OnPageChanging="AspNetPager1_PageChanging" FirstPageText="首页"
LastPageText="尾页" NextPageText="下一页" PagingButtonSpacing="" PrevPageText="上一页"
ScrollBars="Auto" ShowPageIndexBox="Never">



后台
protected DataRowView Info = null; //用于指字类型进行数据绑定
public string RptItemStyle; //设置隔行样式
protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
{
AspNetPager.CurrentPageIndex = e.NewPageIndex;
SearchData();
}
protected void RepReport_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemIndex % 2 == 0) //设置隔行样式
{
RptItemStyle = "RowStyle";
}
else
{
RptItemStyle = "AltRowStyle

";
}
}
protected void RepReport_ItemCreated(object sender, RepeaterItemEventArgs e)
{
Info = e.Item.DataItem as DataRowView;//用于指字类型进行数据绑定
}


protected void RepReport_PreRender(object sender, EventArgs e)
{
//合并 单元格
if (RepReport.Items.Count > 0)
{
double dbeverageScort = 0;

if (RepReport.Items.Count > 1)
{
for (int intIndex = 0; intIndex < RepReport.Items.Count; intIndex++)
{
Label lblScort = (Label)RepReport.Items[intIndex].FindControl("lblScort");
dbeverageScort += double.Parse(lblScort.Text);
}
HtmlTableCell oCell_previous = RepReport.Items[0].FindControl("tdEvergeName") as HtmlTableCell;
oCell_previous.RowSpan = RepReport.Items.Count;
oCell_previous.InnerText = (dbeverageScort / RepReport.Items.Count).ToString("F2");
for (int intIndex = 1; intIndex < RepReport.Items.Count; intIndex++)
{
//删除后面几行的最后一个单元格
HtmlTableCell oCell = RepReport.Items[intIndex].FindControl("tdEvergeName") as HtmlTableCell;
oCell.Visible = false;
}

}
else
{
Label lblScort = (Label)RepReport.Items[0].FindControl("lblScort");
dbeverageScort = double.Parse(lblScort.Text); ;
HtmlTableCell oCell_previous = RepReport.Items[0].FindControl("tdEvergeName") as HtmlTableCell;
oCell_previous.InnerText = dbeverageScort.ToString("F2");
}
}


}

相关文档
最新文档