2012-07-17 78 views
1

我有2個網站;一個是公共和其他的管理員。這些boith是獨立的網站。 theSite.dll是爲公衆和theSiteCMS爲管理員。該呼叫在以下方法或屬性之間不明確:

下面的代碼是從AdminSite即theSiteCMS.This網站還包含也有相同的成員函數Html.ActiveLinkImageSiteSite引用。

我懷疑我無法隔離這些調用,因此錯誤。 請提出正確的方法。

代碼theSiteCMS(管理站點)

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<theSiteCMS.Helpers.Pagination<theSiteCMS.Models.Article>>"%> 

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> 
    Articles Management 
</asp:Content> 

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> 
    <script type="text/javascript" language="javascript"> 
     function goToPage(pageIndex) { 
      $("#page").val(pageIndex); 
      $('#SearchForm').submit(); 
     } 

     function sortField(fld, sortDirection) { 
      $("#sort_field").val(fld); 
      $("#sort_dir").val(sortDirection); 
      $('#SearchForm').submit(); 
      return false; 
     }  
    </script> 
    <h2>Articles Management</h2> 
    <% string[] articles_status = { "Draft", "Submitted", "Published", "Archived", "Deleted" }; %> 
    <% var _gridState = (theSiteCMS.Controllers.ArticlesController.GridState)ViewData["GridState"]; 
     var queryCollection = new { 
        sort_field= _gridState.sort.field 
        ,sort_dir = (_gridState.sort.direction == theSiteCMS.Controllers.AppController.SortDirection.Descending) ? "desc" : "asc" 
        ,status = _gridState.status 
        ,keyword = _gridState.keyword 
        ,username = _gridState.username 
        ,section_id = _gridState.section_id 
        ,category_id = _gridState.category_id 
        ,page = _gridState.page 
     }; 
    %> 
    <%Html.BeginForm("index", "Articles", FormMethod.Post, new { id="SearchForm"}); %> 
    <table width="100%"> 
     <tr> 
      <td width="16%">Status</td> 
      <td width="16%">Section</td> 
      <td width="16%">Category</td> 
      <!--td width="16%">Published</td--> 
      <td width="16%">User</td> 
      <td width="16%">Keyword</td> 
      <td width="4%">&nbsp;</td> 
     </tr> 
     <tr> 
     <td><%= Html.DropDownList("status", theSiteCMS.Controllers.ArticlesController.ArticleStatusList(_gridState.status), "ALL", new { onchange = "this.form.submit();" })%></td> 
     <td><%= Html.DropDownList("section_id", theSiteCMS.Controllers.SectionsController.SectionsList(_gridState.section_id), "--select all--", new { onchange = "this.form.submit();" })%></td> 
     <td><%= Html.DropDownList("category_id", theSiteCMS.Controllers.SectionsController.CategoriesList(_gridState.section_id, _gridState.category_id), "--select all--", new { onchange = "this.form.submit();" })%></td> 
     <!--td><%/* Html.jQuery().DatePicker() 
        .Name("publish_at") 
        .DateFormat("mm-dd-yy") 
        .NavigationAsDateFormat(true) 
        .HtmlAttributes(new { style="width:100px"}) 
        .Render();*/ %></td--> 
     <td><%= Html.TextBox("username", _gridState.username, new { style = "width:100px" })%></td> 
     <td><%= Html.TextBox("keyword", _gridState.keyword, new { style="width:100px"})%></td> 
     <td width="15%"><input type="submit" value="find" /></td> 
     </tr> 
    </table> 
    <%=Html.Hidden("sort_dir", _gridState.sort.direction == theSiteCMS.Controllers.AppController.SortDirection.Descending?"desc":"asc") %> 
    <%=Html.Hidden("sort_field", _gridState.sort.field) %> 

    <%=Html.Hidden("page", _gridState.page) %> 
    <%Html.EndForm(); %> 


    <hr /> 

    <table width ="100%"> 
    <caption><%= ViewData["Message"] %></caption> 
     <tr> 
      <th>Action</th> 
      <th><%= Html.ActionLink("Title", "Index", new { action="Index"}, new { @class = Html.GetSortCssClass(_gridState.sort, "title"), onclick = "return sortField('title','asc');" })%></th> 
      <th><%= Html.ActionLink("Author", "Index", new { action="Index"}, new { @class = Html.GetSortCssClass(_gridState.sort, "user_id"), onclick = "sortField('user_id','asc');return false;" })%></th> 
      <th><%= Html.ActionLink("Date", "Index", new { action="Index"}, new { @class = Html.GetSortCssClass(_gridState.sort, "publish_at"), onclick = "sortField('publish_at','asc');return false;" })%></th> 
      <th><%= Html.ActionLink("Status", "Index", new { action="Index"}, new { @class = Html.GetSortCssClass(_gridState.sort, "status"), onclick = "sortField('status','asc');return false;" })%></th>   
      <th> 
       Comments 
      </th> 
      <th> 
       View count 
      </th> 
     </tr> 

    <% foreach (var item in Model) 
     { %> 

     <tr> 
      <td width="100"> 
       <%=Html.ActionLinkImage("Edit", Url.Content("~/images/icons/pencil.png"), "Edit", new { action = "Edit", id = item.id }, new { title = "Edit" })%> 
       <%=Html.ActionLinkImage("View", Url.Content("~/images/icons/eye.png"), "Details", new { action = "Details", id = item.id }, new { title = "View" })%><br /> 
       <% if (item.status ==0){ //draft%> 
        <%=Html.Image("~/images/icons/application_edit.png", new {@class="disabled"}) %> 
       <%} else {%> 
        <%=Html.ActionLinkImage("Draft", Url.Content("~/images/icons/application_edit.png"), "changeStatus", new { action = "changeStatus", id = item.id, s = 0 }, new { title="Draft"})%> 
       <%} %> 

       <% if (item.status ==1){ //submit%> 
        <%=Html.Image("~/images/icons/application_go.png", new {@class="disabled"}) %> 
       <%} else {%> 
        <%=Html.ActionLinkImage("Draft", Url.Content("~/images/icons/application_go.png"), "changeStatus", new { action = "changeStatus", id = item.id, s = 1 }, new { title = "Submit" })%> 
       <%} %> 
       <% if (item.status ==2){ //publish %> 
        <%=Html.Image("~/images/icons/accept.png", new {@class="disabled"}) %> 
       <%} else {%> 
        <%=Html.ActionLinkImage("Publish", Url.Content("~/images/icons/accept.png"), "changeStatus", new { action = "changeStatus", id = item.id, s = 2 }, new { title = "Publish" })%> 
       <%} %>         
       <% if (item.status ==3){ //archive %> 
        <%=Html.Image("~/images/icons/compress.png", new {@class="disabled"}) %> 
       <%} else {%> 
        <%=Html.ActionLinkImage("Archive", Url.Content("~/images/icons/compress.png"), "changeStatus", new { action = "changeStatus", id = item.id, s = 3 }, new { title = "Archive" })%> 
       <%} %> 
       <% if (item.status ==4){ //deleted %> 
        <%=Html.Image("~/images/icons/application_delete.png", new {@class="disabled"}) %> 
       <%} else {%> 
        <%=Html.ActionLinkImage("Archive", Url.Content("~/images/icons/application_delete.png"), "changeStatus", new { action = "changeStatus", id = item.id, s = 4 }, new { title = "Delete" })%> 
       <%} %>      
      </td> 
      <td> 
       <%= Html.Encode(item.title)%><br/> 
       <%= Html.Encode(item.Category.Section.title)%> , <%= Html.Encode(item.Category.title)%> 
      </td> 
      <td> 
       <%= Html.Encode(item.User.username)%> 
      </td> 

      <td> 
       <%= Html.Encode(String.Format("{0:g}", item.publish_at))%> 
      </td> 

      <td> 
       <%= Html.Encode(articles_status[item.status])%> 
      </td> 
      <td>     
       <%= Html.Encode(item.Comments.Count())%> 
      </td> 
      <td> 
       <%= Html.Encode(item.viewcount)%> 
      </td> 

     </tr> 

    <% } %> 

    </table> 

    <div class="pagination"> 
     <% if (Model.HasPreviousPage) 
      { %> 
      <%= Html.RouteLink("previous", 
           "Default", 
           new { page = (Model.PageIndex - 1) })%> 

     <% } 
      else 
      { %> 
      previous 
     <%} %> 
     | 
     <% if (Model.HasNextPage) 
      { %> 

      <%= Html.RouteLink("next", 
           "Default", 
           new { page = (Model.PageIndex + 1) })%> 

     <% } 
      else 
      { %>  
      next 
     <%} %> 
    </div> 
</asp:Content> 

的錯誤,我得到:

The call is ambiguous between the following methods or properties: 
'System.Web.Mvc.Html.HtmlExtensions.ActionLinkImage(System.Web.Mvc.HtmlHelper, string, string, string, object, object)' 
and 
'System.Web.Mvc.Html.HtmlExtensions.ActionLinkImage(System.Web.Mvc.HtmlHelper, string, string, string, object, object)' 
\My Documents\Visual Studio 2008\Projects\3ICMS\Views\Articles\Index.aspx 111 
------ 
The call is ambiguous between the following methods or properties: 
'System.Web.Mvc.Html.HtmlExtensions.ActionLinkImage(System.Web.Mvc.HtmlHelper, string, string, string, object, object)' 
'System.Web.Mvc.Html.HtmlExtensions.ActionLinkImage(System.Web.Mvc.HtmlHelper, string, string, string, object, object)' 
\My Documents\Visual Studio 2008\Projects\3ICMS\Views\Articles\Index.aspx 116 
------ 
The call is ambiguous between the following methods or properties: 
'System.Web.Mvc.Html.HtmlExtensions.ActionLinkImage(System.Web.Mvc.HtmlHelper, string, string, string, object, object)' 
and 
'System.Web.Mvc.Html.HtmlExtensions.ActionLinkImage(System.Web.Mvc.HtmlHelper, string, string, string, object, object)' 
\My Documents\Visual Studio 2008\Projects\3ICMS\Views\Articles\Index.aspx 106 
------ 
The call is ambiguous between the following methods or properties: 
'System.Web.Mvc.Html.HtmlExtensions.ActionLinkImage(System.Web.Mvc.HtmlHelper, string, string, string, object, object)' and 
'System.Web.Mvc.Html.HtmlExtensions.ActionLinkImage(System.Web.Mvc.HtmlHelper, string, string, string, object, object)' 
\My Documents\Visual Studio 2008\Projects\3ICMS\Views\Articles\Index.aspx 101 
+0

嘗試使用完全限定名稱來調用方法。例如。 AdminDLL.ClassName/Instance.MethodName – Shailesh 2012-07-17 11:54:52

+0

@Teresko,我在代碼 – user1511069 2012-07-17 11:58:11

回答

1

看起來你有2個不同的版本中引用的DLL System.Web.Mvc的不知何故,它不知道該打電話給誰。

+0

下面提到了錯誤消息...一切都解決了......該網站在新機器上作爲網站打開,而不是項目解決方案。我認爲問題是在網站模式下,多個.dll文件在編譯時創建,但在Project Solution中只創建一個.dll文件,因此所有不明確的問題都得到解決。 – user1511069 2012-07-27 05:05:33

1

我的建議將是從'theSiteCMS'刪除System.Web.MVC的任何引用(因爲'theSite.dll'已經包含了它),然後添加theSiteDLL項目referece

我假設它們都在同一個解決方案文件中。我希望這有幫助。

相關問題