I have a gridview and showfooter properties is enable. I want to add one extra row to the footer. So i did like this. I debug the solution its added the new row to the gridview but when gridview binded it does empty footer row.
else if (e.Row.RowType.Equals(DataControlRowType.Footer))
{
if (KONF.Checked)
{
budget bb = new budget(ddLocation.SelectedValue, ddBuilding.SelectedValue);
string budgetAmount = bb.calculateBudget(txtStartDate.Text, txtEndDate.Text);
TableRow tableRow = new TableRow();
TableCell cell0 = new TableCell();
TableCell cell1 = new TableCell();
TableCell cell2 = new TableCell();
TableCell cell3 = new TableCell();
TableCell cell4 = new TableCell();
TableCell cell5 = new TableCell();
TableCell cell6 = new TableCell();
cell0.Text = string.Empty;
cell1.Text = "Budget";
cell2.Text = string.Empty;
cell3.Text = string.Empty;
cell4.Text = string.Empty;
cell5.Text = budgetAmount;
cell6.Text = string.Empty;
tableRow.Controls.Add(cell0);
tableRow.Controls.Add(cell1);
tableRow.Controls.Add(cell2);
tableRow.Controls.Add(cell3);
tableRow.Controls.Add(cell4);
tableRow.Controls.Add(cell5);
tableRow.Controls.Add(cell6);
e.Row.NamingContainer.Controls.Add(tableRow);
}
}
Member
297 Points
940 Posts
Extra row in gridview footer
Dec 15, 2016 10:56 PM|shahid.majeed|LINK
Hi,
I have a gridview and showfooter properties is enable. I want to add one extra row to the footer. So i did like this. I debug the solution its added the new row to the gridview but when gridview binded it does empty footer row.
All-Star
18815 Points
3831 Posts
Re: Extra row in gridview footer
Dec 16, 2016 08:12 AM|Nan Yu|LINK
Hi,
If you want to add additional rows to the footer, you have to catch hold of the OnRowDataBound Event . Code below is for your reference :
Markup:
Best Regards,
Nan Yu
Member
297 Points
940 Posts
Re: Extra row in gridview footer
Dec 16, 2016 09:06 AM|shahid.majeed|LINK
This is exactly same code what i have in my gridview rowdatabound event handler. But it shows empty footer.
gridvie markup
RowDataBound
Member
492 Points
194 Posts
Re: Extra row in gridview footer
Dec 29, 2016 09:09 AM|meeyourmark|LINK
when binding the footer , you could refer to below article:
https://msdn.microsoft.com/en-us/library/bb310552.aspx
When use your code , the added row will show , but you didn't bind the footer .