2012-07-17 108 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

我假设它们都在同一个解决方案文件中。我希望这有帮助。

相关问题