我目前正在使用网页C#,并且具有2个gridview,如下所示:
Gridview 1
-------------------------------
| ID | Name | Polis | TSI |
|------|------|-------|-------|
| 1 | John | 10% | x |
| 2 | Alex | 24% | x |
| 3 | Rita | 5% | x |
-------------------------------
Gridview 2
-------------------------------
|Premi |Materai| Biaya | Total |
|------|-------|-------|-------|
| 100 | 6 | 30% | y |
| 200 | 6 | 10% | y |
| 300 | 6 | 25% | y |
-------------------------------
我想知道,我如何获得X和Y:
TSI = Premi * Polis
和
总数=城邦+ TSI + PREMI + MATERAI +比亚亚
到目前为止,这是我的代码。
protected void gv1_CustomUnbound(object sender, ASPxGridViewColumnDataEventArgs e)
{
if (e.Column.FieldName == "TSI")
{
int premi = Convert.ToInt32(gv2.GetSelectedFieldValues("Premi").ToString());
int polis = Convert.ToInt32(gv1.GetSelectedFieldValues("Polis").ToString());
e.Value = premi * polis;
}
}
protected void gv2_CustomUnbound(object sender, ASPxGridViewColumnDataEventArgs e)
{
if (e.Column.FieldName == "Total")
{
int premi = Convert.ToInt32(gv2.GetSelectedFieldValues("Premi").ToString());
int polis = Convert.ToInt32(gv1.GetSelectedFieldValues("Polis").ToString());
int tsi = Convert.ToInt32(gv1.GetSelectedFieldValues("TSI").ToString());
int materai = Convert.ToInt32(gv2.GetSelectedFieldValues("Materai").ToString());
int biaya = Convert.ToInt32(gv2.GetSelectedFieldValues("Biaya").ToString());
e.Value = Polis + TSI + PREMI + MATERAI + BIAYA
}
}
非常感谢。赞赏