TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ramco Ramco
440
3.4k
529.6k
Refresh DataTable on Update
May 28 2021 4:10 PM
Hi
I have below code in Js file. I want when User Update record , datatable should get refreshed.
function
Update() {
var
res = validate();
if
(res ==
false
) {
return
false
;
}
var
objLocation = {
Id: $(
'#txtId'
).val().toUpperCase(),
Description: $(
'#txtDescription'
).val().toUpperCase()
};
$.ajax({
url:
"/Home/Update"
,
data: JSON.stringify(objLocation),
type:
"POST"
,
contentType:
"application/json;charset=utf-8"
,
dataType:
"json"
,
success:
function
(result) {
$(
'#myModal'
).modal(
'hide'
);
clearTextBox();
},
error:
function
(errormessage) {
alert(errormessage.responseText);
}
});
}
****************************************************
$(document).ready(
function
() {
$(
"#tblLocation"
).dataTable({
ajax: {
type:
"get"
,
url:
"/Location/List"
,
dataType:
"json"
,
dataSrc:
""
},
paging:
true
,
sort:
true
,
pageLength: 5,
searching:
true
,
columns: [
{
'data'
:
'Id'
},
{
'data'
:
'Description'
},
{
"defaultContent"
:
'<input type="button" id="btnEdit" class="btn btn-primary" value="Edit" />'
}
]
});
$(
'body'
).on(
'click'
,
'[id*=btnEdit]'
,
function
() {
var
data = $(
this
).parents(
'tr'
).find(
'td'
);
var
id = data.eq(0).html();
var
description = data.eq(1).html();
$(
'[id*=txtId]'
).val(id);
$(
'[id*=txtDescription]'
).val(description);
$(
'#myModal'
).modal(
"show"
);
});
});
Thanks
Reply
Answers (
1
)
Hide/Show Repeater Control Column based on condition
apply alternative style for gridview merge rows