我正在尝试尽可能使用Kentico最佳实践开发自定义模块。我一直在https://docs.kentico.com/k10/custom-development/creating-custom-modules关注这篇文章,但是我发现以下方面的方向很少:
1 - 在处理自定义UniGrid时,我没有运气使用EditActionUrl传递参数。根据我的理解,在Columns属性中声明的第一列应该是0索引字符串格式参数,但是我的EditActionUrl是"〜/ CMSModules / VendorOrders / EditVendorOrder.aspx?VendorID = {0}"始终采用' {0}'作为文字。我使用它的唯一方法是使用Response.Redirect()创建一个自定义OnAction处理程序到相应的编辑器页面,但这对我来说并不是最好的做法。这是我的相关来源:
ASPX:
<cms:UniGrid ID="gridCurrentOrders" runat="server" OrderBy="Name"
Columns="VendorID,Name,ItemCount,TotalQuantity,TotalCost"
EditActionUrl="~/CMSModules/VendorOrders/EditVendorOrder.aspx?VendorID={0}">
<GridActions Width="50">
<ug:Action Name="edit" Caption="$General.Edit$" FontIconClass="icon-edit" FontIconStyle="allow" />
</GridActions>
<GridColumns>
<ug:Column source="Name" caption="Vendor" width="50"></ug:Column>
<ug:Column source="ItemCount" caption="Item Count" width="25"></ug:Column>
<ug:Column source="TotalQuantity" caption="Total Qty" width="25"></ug:Column>
<ug:Column source="TotalCost" caption="Item Cost" width="100%"></ug:Column>
</GridColumns>
</cms:UniGrid>
代码背后:
protected void Page_Load(object sender, EventArgs e)
{
// Calculate which SKUs need to be reordered as follows:
// When [AvailableItems] + [Amount unshipped already on an open vendor order] is at or less than [ReorderAt], reorder [ReorderQuantity]
gridCurrentOrders.DataSource = SKUInfoProvider.GetSKUs()
.Source(sku => sku.Join<VendorInfo>("SKUVendorID", "VendorID"))
.Where("SKUAvailableItems <= SKUReorderAt")
.GroupBy("VendorID", "Name")
.Columns("VendorID, Name, count(SKUID) as ItemCount, sum(SKUReorderQuantity) as TotalQuantity, sum(SKUVendorCost * SKUReorderQuantity) as TotalCost")
.Result;
}
2 - 在自定义模块UI页面中使用内置模板时,您只需检查&#34;显示面包屑&#34;但是,出于看似显而易见的原因,当Type =&#34; URL&#34;时,这并没有做任何事情。有没有一种标准方法可以在自定义.aspx模块页面上连接面包屑?
TIA,-Keith
答案 0 :(得分:1)
是的,您需要创建OnAction处理程序
protected void gridElem_OnAction(string actionName, object actionArgument)
{
if (actionName == "edit")
{
URLHelper.Redirect(UrlResolver.ResolveUrl("/CMSModules/VendorOrders/EditVendorOrder.aspx?VendorID=" + Convert.ToString(actionArgument)));
}
}