string ListID = cWeb.Lists[listName].ID.ToString();
ListID = ListID.Replace("-", "%2D");
btnEdit.Attributes.Add("onclick",
"OpenDialog('" +
cWeb.Url +
"/Lists/myList/Item/editifs.aspx?List=" +
ListID +
"&ID=" + listItem.ID +
"&ContentTypeId=" +
listItem.ContentTypeId +
"&IsDlg=1'); return false;");
In JavaScript, within the ascx file this is added
//User Defined Function to Open Dialog Framework
function OpenDialog(strPageURL) {
OpenCustomDialog(strPageURL, 1050, 500, "Edit");
return false;
}
function OpenCustomDialog(dialogUrl, dialogWidth,
dialogHeight, dialogTitle,
dialogAllowMaximize, dialogShowClose) {
var options =
{
url: dialogUrl,
allowMaximize: dialogAllowMaximize,
showClose: dialogShowClose,
width: dialogWidth,
height: dialogHeight,
title: dialogTitle,
dialogReturnValueCallback: function (dialogResult) {
SP.UI.ModalDialog.RefreshPage(dialogResult)
}
}
SP.UI.ModalDialog.showModalDialog(options);
}
No comments:
Post a Comment