Redirect to ASPx pages on button click
Redirect to ASPx pages on button click
shahbhavinkumar
Posts: 4Questions: 2Answers: 0
I recently started using Datatable js, and I love it. I am using it with my aspx applications however I am somehow not able to redirect it to other pages. I have a button on my form which fetches me the data in the table however I am not able to redirect it or call the aspx methods using that. I tried to look up various sources but could not find any answer.
This discussion has been closed.
Answers
If I do
$('#example tbody tr').click(function () {
var redirection = $(this).attr('id');
document.location.href = "EditFormDashboard.aspx?FormId=" + redirection;
});
this things works but if do the same on button click, like
$('#example tbody').on('click', 'button', function () {
var redirection = $(this).attr('id');
document.location.href = "EditFormDashboard.aspx?FormId=" + redirection;
would not work.
In your first example you are getting the id of the tr element. In your second example you are getting the id of the button element. The 'this' keyword references the element that pops the event. If you are trying to get the id of the tr element in the second example it should look like this: