Click here to Skip to main content
15,915,080 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to display the sum of previous two columns and show the result in third column?"
Posted

1 solution

XML
<asp:GridView runat="server" ID="GV" OnRowDataBound="test_rodatbond">
    <Columns>
    <asp:BoundField DataField="v1" />
    <asp:BoundField DataField="v2" />
    <asp:TemplateField>
    <ItemTemplate>
    <asp:Label ID="lbl" runat="server"></asp:Label>
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
    </asp:GridView>



and at codebehind

C#
protected void test_rodatbond(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Label lbl = (Label)e.Row.FindControl("lbl");
            lbl.Text = GV.Rows[e.Row.RowIndex].Cells[0].Text + GV.Rows[e.Row.RowIndex].Cells[1].Text;

        }
    }
 
Share this answer
 
Comments
Ni!E$H_WAGH 4-Mar-14 4:11am    
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900