ASPxGridView和Linq常用总结(2)(2)
}
}
//源
//grd
<ClientSideEvents FocusedRowChanged="function(s, e) { getQueryTable(); }"/>
2、删除一行
//js页面
function getDeleteDriver() {
var sDriverId = grdDriver.GetRowValues(grdDriver.GetFocusedRowIndex(), 'DriverID;DriverName',
DeleteDriver);
}
//删除菜单
function DeleteDriver(values) {
var key = values[0];
if (key != null) {
var r = confirm('您确定要删除此司机信息吗?');
if (r == true) {
var r_Del = Driver.DeleteDriver(key);
if (r_Del.value != "成功") {
alert(r_Del.value);
}
else {
grdDriver.PerformCallback("");
}
}
}
else {
alert('请选中您要删除的模块!');
}
}
//cs页面
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.Read)]
public string DeleteDriver(string iCode)
{
try
{
Tb_Driver objDriver = linqData.Tb_Driver.SingleOrDefault(p => p.DriverID == Convert.ToInt32
(iCode));
if (objDriver != null)
{
linqData.Tb_Driver.DeleteOnSubmit(objDriver);
linqData.SubmitChanges();
return "成功";
相关新闻>>
- 发表评论
-
- 最新评论 更多>>