Net/VAT/Gross calculation in Gridview

Last post 04-20-2007 9:55 AM by jvdv360. 2 replies.

Sort Posts:

  • Net/VAT/Gross calculation in Gridview

    04-17-2007, 6:56 PM
    • Loading...
    • elvislives
    • Joined on 04-17-2007, 10:27 PM
    • Posts 2

    I'm somewhat new to asp.net development, and so please excuse my ignorance.

    I am trying to play around with building a timesheet and expense app, and i am stuck on trying to update a second field in the gridview by entering a value into a first field whilst remaining in the EditItem mode.

    Basically, when entering expense items, I would like the user to be able to either enter a Net amount and have the VAT and Gross values calculated, or enter a gross amount and have the Net and VAT calculated. However, after entering a value, I want the gridview to remain in Edit mode, as the VAT might need to be keyed if there is a rounding difference causing it to be a penny out.

    I have set the Net, VAT, and Gross fields to be Template fields, and have set the following properties of the Net asp:TextBox:

    OnTextChanged="DoNetVATGrossUpdate" AutoPostBack="true"

    The code is called okay. However, I haven't got a clue what code to put in there to change the VAT and Gross fields. I did manage to update the field, but this was by finding the parent of the sender (the gridview), finding the row index of the cell being modified, and then setting the GridView.Cells(row index number).Text = VATAmount. However, this made the cell show a value, but removed the data binding.

    Is it possible to do what I want to do in the GridView, and if so, how?

    Thanks in advance for any advice.

  • Re: Net/VAT/Gross calculation in Gridview

    04-17-2007, 7:33 PM
    • Loading...
    • elvislives
    • Joined on 04-17-2007, 10:27 PM
    • Posts 2
    Whoops, my first post and I figured it out as soon as I clicked the Post button. Please ignore my stupidity.
  • Re: Net/VAT/Gross calculation in Gridview

    04-20-2007, 9:55 AM
    • Loading...
    • jvdv360
    • Joined on 03-15-2007, 7:33 AM
    • Posts 32
    Can you please post the code with the solution? I'm struggling with a similar problem at the moment...
Page 1 of 1 (3 items)
Microsoft Communities
Page view counter