MenuItemTemplate.ClientOnClickPostBackConfirmation 属性
设置或检索要显示当ClientOnClickUsingPostBackEvent属性设置的确认消息。
命名空间: Microsoft.SharePoint.WebControls
程序集: Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)
语法
声明
Public Property ClientOnClickPostBackConfirmation As String
Get
Set
用法
Dim instance As MenuItemTemplate
Dim value As String
value = instance.ClientOnClickPostBackConfirmation
instance.ClientOnClickPostBackConfirmation = value
public string ClientOnClickPostBackConfirmation { get; set; }
属性值
类型:System.String
表示的确认消息String 。
备注
如果ClientOnClickPostBackConfirmation属性设置后ClientOnClickNavigateUrl属性设置,则会将ClientOnClickNavigateUrl重置为空引用(无 在 Visual Basic 中)。
值ClientOnClickNavigateUrl属性可能包含客户端替换的令牌括在百分号 (%) 字符。
示例
本示例演示如何对 Ecma 脚本函数的调用中包括动态替换的令牌。请注意令牌的值必须正确编码用于为 URL 参数中引用 Ecma 脚本字符串值。
MenuTemplate customerMenu = new MenuTemplate();
MenuItemTemplate editCustomer =
new MenuItemTemplate("Edit", "/images/edit.gif");
editCustomer.ClientOnClickNavigateUrl =
"/EditCustomer.aspx?Id='%CustomerId%'";
customerMenu.Add(editCustomer);
MenuItemTemplate deleteCustomer =
new MenuItemTemplate("Delete", "/images/delete.gif");
deleteCustomer.ClientOnClickScript =
"ConfirmDeleteThenPostBack(this, '%CustomerId%', '%CustomerName%')";
customerMenu.Add(deleteCustomer);
MenuItemTemplate displayInvoices =
new MenuItemTemplate("Display Invoices", "/images/invoice.gif");
displayInvoices.SetClientOnClickUsingPostBackEvent(InvoiceDetailControl,
"CustomerId=%CustomerId%");
customerMenu.Add(displayInvoices);
...
foreach(Customer customer in CustomersResults)
{
TableCell cell = new TableCell();
row.Add(cell);
Menu menu = new Menu();
menu.TokenValues.Add("CustomerId", customer.Id.ToString());
menu.TokenValues.Add("CustomerName", customer.Name);
cell.Add(menu);
}
Dim customerMenu As New MenuTemplate()
Dim editCustomer As New MenuItemTemplate("Edit", "/images/edit.gif")
editCustomer.ClientOnClickNavigateUrl = "/EditCustomer.aspx?Id='%CustomerId%'"
customerMenu.Add(editCustomer)
Dim deleteCustomer As New MenuItemTemplate("Delete", "/images/delete.gif")
deleteCustomer.ClientOnClickScript = "ConfirmDeleteThenPostBack(this, '%CustomerId%', '%CustomerName%')"
customerMenu.Add(deleteCustomer)
Dim displayInvoices As New MenuItemTemplate("Display Invoices", "/images/invoice.gif")
displayInvoices.SetClientOnClickUsingPostBackEvent(InvoiceDetailControl, "CustomerId=%CustomerId%")
customerMenu.Add(displayInvoices)
...
For Each customer As Customer In CustomersResults
Dim cell As New TableCell()
row.Add(cell)
Dim menu As New Menu()
menu.TokenValues.Add("CustomerId", customer.Id.ToString())
menu.TokenValues.Add("CustomerName", customer.Name)
cell.Add(menu)
Next customer
下面的示例演示如何使用 ASPX 标记中声明一个菜单。
<SharePoint:MenuTemplate runat="server" id="CustomerMenu">
<SharePoint:MenuItemTemplate id="CustomerMenu_Edit"
runat="server" Text="Edit"
ClientOnClickNavigateUrl="/EditCustomer.aspx?Id='%CustomerId%" />
ImageUrl="/images/edit.gif" />
<SharePoint:MenuItemTemplate id="CustomerMenu_Delete" runat="server"
Text="Delete"
ClientOnClickScript="ConfirmDeleteThenPostBack(this, '%CustomerId%',
'%CustomerName%')"
ImageUrl="/images/delete.gif" />
</SharePoint:MenuTemplate>