I have grid view inside it I have debit/credit column and amount column in the credit and debit column if v\_flag = d then return debit else return credit html I wrote this :

```
<asp:TemplateField HeaderText="debit/credit">
            <ItemTemplate>
                 <asp:Label ID="debit" runat="server" Text='<%# (Eval("v_flag").ToString() =="d" ) ? "debit": "credit" %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>

        <asp:BoundField  DataField="v_amount" 
                                HeaderText="المبلغ" ItemStyle-Font-Size="Small"/>

```

and it's work fine but when am trying to get the total of the credit only out side the gridview in text box and the total of the debit only out side the gridview in text box 
using this code :

```
   for (int i = 0; i < GridView1.Rows.Count; ++i)
            {
                if (GridView1.Rows[i].Cells[3].Text.Equals("credit"))
                {
                    sumCredit += Convert.ToDouble(GridView1.Rows[i].Cells[4].Text);
                    TxtCredit.Text = sumCredit.ToString();
                }
                else
                {
                    sumDebit += Convert.ToDouble(GridView1.Rows[i].Cells[4].Text);
                    TxtDebit.Text = sumDebit.ToString();
                }
            }

```

if (GridView1.Rows[i].Cells[3].Text.Equals("credit")) not working it's always go directly to else statement