1

I have a gridview with 2 template buttons: (1) Approve and (2) Rejected..When one of the buttons is clicked the status of the row will change to either Approve or Rejected and update the 'Status' field in the database. I am using this in money transactions.

What i want to happen is to prevent the page to postback when either of the button is clicked. How can i do this in jquery? How can i get the status of the row from the database then pass it to jquery so that when i click the button it will not post back( so that the payment of a customer will only be added once to the currenct balance of the merchant ).

Please help, I have no idea on how to do this...

1
  • i have no codes yet because i dont know how to start...ahahah Commented Jun 6, 2013 at 2:03

2 Answers 2

3

You can do it with Ajax. To post some data without postback.

Sign up to request clarification or add additional context in comments.

1 Comment

Are you using Asp.Net webforms since its about postback? If that's the case, try to read this: dotnetspark.com/kb/…
1

When render a table row, you add some id to row like this

<table>
  <tr data-id="1">
    <td>Name</td>
    <td><button class="approve">Aprove</button><button class="reject">Reject</button></td>
  </tr>
</table>

Then use jquery, ajax to catch button press

$('.approve').click(function(){
   var id = $(this).parents('tr').data('id');/// Here is your id
   $.post('/approve/',{id:id}, function(data){

   })
});

1 Comment

i am using gridview..not table...what will i replace tr with..?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.