HI.


I was taken one grid view, in that gridview there is 6 text boxes are there (sun1b,mon1b,...... total1b), I want to add (sum) those textbox valus without ''ADD Button ''click . I need to add the text box values (Horizontal, vertical ) total, I attached the image, u r understanding purpose.

It is possible to add the text box values ? pls help me!!

Of course it is. Are the textboxes populated from a database or are they using user input? If working from a database you simply perform the calculation at the same time you populate the textboxes.
If it is from user input and you don't want a button press to be required its a little trickier. You would need to code up something in the last textbox that performed the adding function - how well this would work would depend on the data (is there anyway to know when the user has fiinished entering the data in the tetxbox?).

it is very interesting question. but if it is possible then definitely u should have some kind of logic like addition .

If you are good in javascript let me explain the soultion:

  1. Take the grid in javascript e.g.
    var tblGrid = document.getElementById("grdXXXXX");
  2. for (var i = 1; i < (TotalCount); i++) {
    CurrentRow = tblGrid.rows[i];
    firstcolumn = CurrentRow.children[0].children[0];
    secondcolumn = CurrentRow.children[1].children[0];
    thirdcolumn = CurrentRow.children[2].children[0];
    ......................
    }

  3. Add up all columns and assign it to your desire column.
  4. Make all processing given above as function.
  5. Attach this function to all of you textboxes except total on "OnBlur" or "ObFocusOut" or "OnClick" client side event.

Let me know if it helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.