Javascript
function OpenDialog(sPageURL) {
options = SP.UI.$create_DialogOptions();
options.width = 650;
options.height = 650;
options.url = sPageURL;
options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);
SP.UI.ModalDialog.showModalDialog(options);
}
function CloseCallback(result, target) {
location.reload(true);
}
.aspx page
<tr>
<td class="ms-addnew" style="padding-bottom: 5px; width:100%">
<span style="height:10px;width:10px;position:relative;display:inline-block;overflow:hidden;" class="s4-clust"><img src="/_layouts/images/fgimg.png" alt="" style="left:-0px !important;top:-128px !important;position:absolute;" />
</span> <span id="addNewLink" runat="server"></span>
<a href="\" id="ahAddNew" runat="server" ></a>
</td>
</tr>
.cs page
ahAddNew.HRef = "javascript:OpenDialog('" + oWeb.Url + "/_layouts/listform.aspx?PageType=8&ListId={" + oCalendarList.ID + "}&RootFolder=&ContentTypeId=" + oCalendarList.ContentTypes["Mission"].Id.ToString() + "')";
ahAddNew.InnerText = string.Empty;
ahAddNew.InnerText = "Add new mission";
No comments:
Post a Comment