我有一个gridview,我必须绑定gridview中的数据以及gridview的页脚。我尝试了很多东西,但没有任何工作。谁能告诉我我必须做什么?我使用相同的查询绑定页脚中的gridview,或者我必须为gridview和页脚编写不同的查询。以下是我的工作。我试过的是为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);
PLZ帮我提前谢谢
答案 0 :(得分:1)
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();
}
}
}
试试这个。