私は DNN 用の C# のモジュールを持っています。その目的は、顧客のリストを表示し、特定のグループの人だけがページとそのデータを表示できるようにすることです。これは、ビュー パーツの ascx ファイルです
<%@ Control Language="C#" Inherits="OnCoreNet.Modules.CFT_Manager.ViewCFT_Manager"
AutoEventWireup="true" CodeBehind="ViewCFT_Manager.ascx.cs" %>
<asp:GridView ID="customerGrid" runat="server" EnableModelValidation="True"
Width="100%" AllowPaging="True" AutoGenerateColumns="False"
PagerSettings-Mode="NumericFirstLast"
PagerSettings-PageButtonCount="10"
onpageindexchanging="customerGrid_PageIndexChanging"
onrowdatabound="customerGrid_RowDataBound">
<Columns>
<asp:BoundField HeaderStyle-Width="50px" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField ConvertEmptyStringToNull="False" HeaderText="Cust. Name"
NullDisplayText=" " ReadOnly="True" DataField="CFT_CustomerName" />
<asp:BoundField ConvertEmptyStringToNull="False" DataField="CFT_CustomerKey"
HeaderText="Cust. Key" NullDisplayText=" " ReadOnly="True" HeaderStyle-Width="100px" />
<asp:BoundField ConvertEmptyStringToNull="False" DataField="CFT_CustomerCode"
HeaderText="Cust. Code" NullDisplayText=" " ReadOnly="True" HeaderStyle-Width="100px" />
</Columns>
</asp:GridView>
最初のセルに、次のコードを使用して、編集と削除の 2 つのアイコンを表示します。
protected void customerGrid_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
CFT_ManagerInfo customerInfo = (CFT_ManagerInfo)e.Row.DataItem;
e.Row.Cells[0].Controls.Clear();
ImageButton imgEdit = new ImageButton();
imgEdit.ImageUrl = "/images/edit.gif";
imgEdit.PostBackUrl = EditUrl("CFT_ID", customerInfo.CFT_ID.ToString());
imgEdit.CommandName = "EditCustomerBtn";
e.Row.Cells[0].Controls.Add(imgEdit);
ImageButton imgDel = new ImageButton();
imgDel.ImageUrl = "/images/delete.gif";
imgEdit.PostBackUrl = EditUrl("CFT_Customer_ID", customerInfo.CFT_ID.ToString(), "DelCustomer");
imgEdit.CommandName = "DelCustomerBtn";
e.Row.Cells[0].Controls.Add(imgDel);
Response.Write("Image URL: " + imgEdit.PostBackUrl + "<br>\n");
Response.Write("Image URL: " + imgDel.PostBackUrl + "<br>\n");
//Response.Write("CFT_ID: " + customerInfo.CFT_ID.ToString() + "<br>\n");
}
}
画像は表示されますが、アイコンをクリックするとエラーが表示されます。これらは EditUrl が送信しているリンクです。
http://localhost/CFTTest/tabid/88/ctl/DelCustomer/mid/415/CFT_Customer_ID/11/Default.aspx
目的のページは EditCFT_Manager.ascx と呼ばれ、VS が付けたデフォルト名です。私は何が間違っているのかわかりません。私は DNN モジュール開発に関してはかなり新しいものです..助けてもらえますか?