
Untitled
By: a guest on
May 2nd, 2012 | syntax:
None | size: 1.54 KB | hits: 14 | expires: Never
gridview selected value
Sector Name Amount Invested
Finance 300000
Properties 100000
... ...
double TotalInvestments = 0.0;
for (int i = 0; i < gvSector.Rows.Count; i++)
{
if (gvSector.Rows.Count > 0)
{
double SAmt = Convert.ToDouble(gvSector.Rows[i].Cells[1].Text);
TotalInvestments += SAmt;
double PercentSAmt = (SAmt / TotalInvestments) * 100;
if (PercentSAmt > 25.0)
{
//I've no idea what to put here. It is supposed to show the sector(s) that is more than 25% from the gridview.
}
}
}
protected void Grid_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow) {
var data = (DataRowView)e.Row.DataItem;
var lbSector = (Label)e.Row.FindControl("lbSector");
var amount = (int)data("Amount");
var amountOverAll = (long)data.DataView.Table.Compute("SUM(Amount)", null);
if (amount * 100 / amountOverAll >= 30) {
lbSector.Text = data("Sector").ToString();
}
}
}
double SAmt = Convert.ToDouble(gvSector.Rows[i].Cells[1].Text);
TotalInvestments += SAmt;
double PercentSAmt = (SAmt / TotalInvestments) * 100;
double PercentSAmt = (SAmt / TotalInvestments) * 100;
if (PercentSAmt > 30.0)
{
gvSector.Rows[i].Cells[1].Text
}
double PercentSAmt = (SAmt / TotalInvestments) * 100;
if (PercentSAmt > 30.0)
{
lbSector.Text += gvSector.Rows[i].Cells[0].Text + " ";
}