繁体   English   中英

如何在GridView的页脚中绑定数据

[英]how to bind data in footer of gridview

我有一个gridview,我必须将数据绑定到gridview以及gridview的页脚中。 我已经尝试了很多东西,但是没有任何效果。 谁能告诉我我该怎么办? 我用相同的查询将页脚中的gridview绑定在一起,或者我必须为gridview和footer编写不同的查询。 以下是我的工作。 我尝试过的事情我为gridview和footer编写了不同的查询

System.Web.UI.WebControls.GridView grdview = ystem.Web.UI.WebControls.GridView)sender);
Label lblenqid = (Label)e.Row.FindControl("lblenqid1");
Label lblactualcost = (Label)grdview.FooterRow.FindControl("Label44") as Label;
Label lblpackagecost = (Label)grdview.FooterRow.FindControl("Label42") as Label;
Label lbldriver = (Label)grdview.FooterRow.FindControl("Label46") as Label;
objHotel.Tour_DetailVehiclePackageCost(lblenqid.Text,
                blactualcost,lblpackagecost,lbldriver);

请帮助我先谢谢

protected void yourNiceGridViewControl_RowDataBound(object sender, GridViewRowEventArgs e)
{
  if (e.Row.RowType == DataControlRowType.Footer)
  {
    TextBox myTextBox = e.Row.FindControl("txtFooter") as TextBox;

    if( myTextBox != null ) 
    {

      myTextBox.Tex= ds.Tables[0].Rows[0]["MyFirend"].ToString();
    }
  }
}

尝试这个。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM