【发布时间】:2018-10-12 01:22:19
【问题描述】:
代码背后
protected void ASPxGridView1_AfterPerformCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewAfterPerformCallbackEventArgs e)
{
if (e.Args.Count() > 0)
{
string[] UID = e.Args[0].Split(':');
if (UID[0] == "Complete")
{
try
{
string id = UID[1];
int completeID = Convert.ToInt32(id);
using (TaskListDataContext db = new TaskListDataContext())
{
var list = db.SupportIssues.Where(x => x.UID == completeID).ToList();
if (list.Count > 0)
{
SupportIssue _support = list[0];
if (_support.Status != 1)
{
string uptsql = string.Format("Update dbo.SupportIssues Set Status = 1 Where UID={0}", id);
db.ExecuteCommand(uptsql);
Page_Init(sender, e);
SendCompletedEmail(completeID);
}
else
{
Alert.Show("This issue has been completed");
}
}
}
}
catch (Exception ex)
{
Response.Write(ex.Message + ex.StackTrace);
}
}
}
}
JavaScript
function completeTaskRow(s, e) {
var keys = grid.GetFocusedRowIndex();
var id = grid.GetRowKey(keys);
if (confirm('Mark this issue to complete?')) {
grid.PerformCallback("Complete:" + id);
}
}
如何在AfterPerformCallback 发出警报消息?
尝试了这些解决方案:
- Response.Write("alert('...');");
- ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('...')", true);
- ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Message", "alert('...');", true);
还是不适合我。
【问题讨论】:
标签: javascript c# asp.net