查看:
<img src="~/Content/images/delete.png" onclick="abc" />
脚本:
function abc(blobname, filename, fileextension) {
$('#my-dialog').dialog({
autoOpen: false,
width: 400,
resizable: false,
modal: true,
buttons: {
"Ok": function () {
codeblablabla
$(this).dialog("close");
},
"Cancel": function () {
$(this).dialog("close");
}
}
});
是否可以将参数blobname,filename,fileextension发送到我的对话框?
查看:
<div id="my-dialog"><div>Are you sure you want to delete file: filename+blobname</div></div>
我不想使用viewbag ..
谢谢!
答案 0 :(得分:0)
你可以这样做:
<img
src="~/Content/images/delete.png"
data-dialog="Are you sure you want to do this?"
data-blobname="blah"
/>
然后像这样引用它:
$("[data-dialog]").click(function(){
var msg = $(this).data("dialog");
var blobname = $(this).data("blobname");
// now build your dialog, using the vars created above
$('<div />').html(msg).dialog();
});