Problem when using inline delete, success reponse is coming as xml instead of text
Problem when using inline delete, success reponse is coming as xml instead of text
godis
Posts: 2Questions: 0Answers: 0
Hi,
I am trying to use the inline delete functionality of the datatable and facing problem as the success response is coming as XML instead of simple text.
Here is the details
Aspx code
Delete
Client Script:
$(document).ready(function () {
$('#grdTeam').dataTable({ "bFilter": false, "bSort": false, "bLengthChange": false, "iDisplayLength": 20}).makeEditable({
oAddNewRowFormOptions: {
show: "blind",
hide: "blind",
width: 400
},
bDisableEditing: true,
sAddURL: "Webservice.asmx/AddTeamMember",
sDeleteURL: "Webservice.asmx/DeleteTeamMember"
});
});
}
Service Side aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) BindData();
}
protected void grdTeam_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
GridViewRow row = e.Row;
row.Attributes["id"] = ((GridView)sender).DataKeys[e.Row.RowIndex].Value.ToString();
}
}
private void BindData()
{
DataTable dt = new DataTable("TeamMembers");
dt.Columns.Add("ID");
dt.Columns.Add("Name");
dt.Columns.Add("Role");
dt.Columns.Add("CEIUnit");
dt.Columns.Add("PlannedHours");
dt.Columns.Add("ActualHours");
DataRow dr = dt.NewRow();
dr["ID"] = "5";
dr["Name"] = ABC";
dr["Role"] = "project Manager";
dr["PlannedHours"] = 100;
dr["ActualHours"] = 100;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["ID"] = "10";
dr["Name"] = "XYZ";
dr["Role"] = "Stratagic Resources";
dr["PlannedHours"] = 100;
dr["ActualHours"] = 110;
dt.Rows.Add(dr);
grdTeam.DataSource = dt;
grdTeam.DataBind();
grdTeam.HeaderRow.TableSection = TableRowSection.TableHeader;
}
Webservice.asmx
[WebMethod]
public string DeleteTeamMember(int id)
{
//Delete from DB here
return "ok";
}
The problem i am getting is in "jquery.datatables.editable.js" and "function fnOnRowDeleted(response)" the response is coming as "<?xml version="1.0" encoding="utf-8"?>ok" instead of text message "ok". What i am missing here. It may be simple but i am not able to figure that out. Thank you.
I am trying to use the inline delete functionality of the datatable and facing problem as the success response is coming as XML instead of simple text.
Here is the details
Aspx code
Delete
Client Script:
$(document).ready(function () {
$('#grdTeam').dataTable({ "bFilter": false, "bSort": false, "bLengthChange": false, "iDisplayLength": 20}).makeEditable({
oAddNewRowFormOptions: {
show: "blind",
hide: "blind",
width: 400
},
bDisableEditing: true,
sAddURL: "Webservice.asmx/AddTeamMember",
sDeleteURL: "Webservice.asmx/DeleteTeamMember"
});
});
}
Service Side aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) BindData();
}
protected void grdTeam_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
GridViewRow row = e.Row;
row.Attributes["id"] = ((GridView)sender).DataKeys[e.Row.RowIndex].Value.ToString();
}
}
private void BindData()
{
DataTable dt = new DataTable("TeamMembers");
dt.Columns.Add("ID");
dt.Columns.Add("Name");
dt.Columns.Add("Role");
dt.Columns.Add("CEIUnit");
dt.Columns.Add("PlannedHours");
dt.Columns.Add("ActualHours");
DataRow dr = dt.NewRow();
dr["ID"] = "5";
dr["Name"] = ABC";
dr["Role"] = "project Manager";
dr["PlannedHours"] = 100;
dr["ActualHours"] = 100;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["ID"] = "10";
dr["Name"] = "XYZ";
dr["Role"] = "Stratagic Resources";
dr["PlannedHours"] = 100;
dr["ActualHours"] = 110;
dt.Rows.Add(dr);
grdTeam.DataSource = dt;
grdTeam.DataBind();
grdTeam.HeaderRow.TableSection = TableRowSection.TableHeader;
}
Webservice.asmx
[WebMethod]
public string DeleteTeamMember(int id)
{
//Delete from DB here
return "ok";
}
The problem i am getting is in "jquery.datatables.editable.js" and "function fnOnRowDeleted(response)" the response is coming as "<?xml version="1.0" encoding="utf-8"?>ok" instead of text message "ok". What i am missing here. It may be simple but i am not able to figure that out. Thank you.
This discussion has been closed.
Replies
http://debug.datatables.net/erovow