c# - how to show confirmation dialog from drop down list? -
i have grid display data database, , have custom column in left side checkbox, choose records deleted , have dropdown list, trigger event in server side delete records, before delete records want show confirmation dialog "are sure? ok , cancel", how that? thought?
i :
if(ddlaction.selectedvalue == "delete") { string id = string.empty; int = 0; list<int> idx = new list<int>(); foreach (gridviewrow rowitem in gvdept.rows) { checkbox itemchk = (checkbox)rowitem.findcontrol("cbselectone"); if (itemchk != null & itemchk.checked) { id += rowitem.cells[3].text.tostring() + ','; idx.add(i); } = + 1; } id = id.trim(",".tochararray()); list<string> objremovekeys = id.split(',').tolist(); if (objremovekeys.count > 0) { ddlaction.attributes.add("onchange", "javascript:return confirmdeletion('are sure remove selected items?');"); // part not working. airasialinqdatacontext linqdatactx = new airasialinqdatacontext(); var record = in linqdatactx.departements objremovekeys.contains(a.departementcode) select a; linqdatactx.departements.deleteallonsubmit(record); linqdatactx.submitchanges(); (int j = 0; j < idx.count; j++) { gvdept.deleterow(idx[j]); } } ddlaction.selectedvalue = "";
}
this looks code-behind (c#) code. dialogs happen on client side. can relatively jquery (or vanilla javascript code), or use ajax control toolkit's confirmbutton
:
http://www.asp.net/ajaxlibrary/ajaxcontroltoolkitsamplesite/confirmbutton/confirmbutton.aspx
for little more control on process can give juiceui go: http://juiceui.com/controls/dialog
Comments
Post a Comment