Kamna
Kamna

Reputation: 51

how to bind data in footer of gridview

I have a gridview and I have to bind data in gridview as well as the footer of the gridview. I have tried many things but nothing is working. Can anyone tell me what I have to do can? I bind the gridview in the footer with the same query or I have to write diffrent query for gridview and footer. Below is my work. What I have tried I write diffrent query for both gridview and 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 help me thanks in advance

Upvotes: 2

Views: 1786

Answers (1)

Monika
Monika

Reputation: 2210

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();
    }
  }
}

Try this.

Upvotes: 1

Related Questions