1
我對C#DNN的模塊DNN,目的是爲了顯示客戶列表,並允許某些羣體的唯一的人看到的網頁和他們的數據。這是視圖部分用C#我如何調用edit.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>
在第一個單元格我的ascx文件I顯示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
arget頁面被稱爲EditCFT_Manager.ascx,這是VS給出的defulat名稱。 我不知道我在做什麼錯,我在DNN模塊開發方面相當新。..你能幫我一下嗎?
感謝BDukes ..我錯過了重點。我沒有知道在哪裏把它從.. – Soqui
您好,我能跳到我模塊的編輯形式,但不能從任何查詢字符串視圖模塊,我固定我使用EditURL的方式,參數是Key(我明白是quesry字符串的參數名稱),value(param的vlue)和Controlkey。在我的manfest文件中有一個名爲Key的值,其值爲Edit,我在ControlKey參數中使用了這個值,但仍然沒有值。 – Soqui
補充我上面的問題..我注意到編輯頁面上典型的if(!IsPostBack)條件沒有得到滿足..這是好的,或者我正在做錯什麼? – Soqui