62,244
社区成员




protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
string dt1 = this.TextBox1.Text.Trim();
string dt2 = this.TextBox2.Text.Trim();
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
DataRowView drv = (DataRowView)e.Item.DataItem;
ta1 = ta1 + Convert.ToDecimal(drv["b"]);
ta2 = ta2 + Convert.ToDecimal(drv["a"]);
ta3 = ta3 + Convert.ToDecimal(drv["c"]);
Label labname = (Label)e.Item.FindControl("labname");
string name=labname.Text;
Label labzhichu = (Label)e.Item.FindControl("labzhichu");
Label labcount = (Label)e.Item.FindControl("labcount");
string keyword = labname.Text; //根据人物姓名关联字表,问题在于这个值一直没有传递成功
GridView GridView1 = (GridView)e.Item.FindControl("GridView1");
string mysql = "select a.[dt],a.[type],a.[id],a.[transfer],a.[categoryname],a.[amount],a.[remark],b.[ename],c.[title] as accountname from M_WasteBook a,H_Employee b,M_Account c where a.empid=b.id and a.[accountid]=c.[id] and a.[remark] like '%" + keyword + "%' and a.[dt] between '" + dt1 + "' and '" + dt2 + " 23:59:59' and a.[type]=2";
DataTable mydt = Class1.ExecSel(mysql);
if (mydt != null)
{
try
{
GridView1.DataSource = mydt;
GridView1.DataBind();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
前台代码
包含“<span style="color:#555555"><a href="javascript:void(0)" onclick="javascript:showDiv()"><%# GetName(Eval("empid"))%></a></span>”的支出金额:<asp:Label ID="labzhichu" runat="server"></asp:Label>元,共计<asp:Label ID="labcount" runat="server"></asp:Label>笔