Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8171513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:29:10+00:00 2026-06-06T21:29:10+00:00

I get an error on my View page thats says: Cannot implicitly convert type

  • 0

I get an error on my View page thats says:

Cannot implicitly convert type ‘System.Collections.Generic.List’ to ‘SchoolAdministrator.SchoolAdminProductionServices.SchoolTypeRef’

I want to know how come Im getting these errors. I believe I am doing everything right

Controller

 [SchoolAuthorizeAttribute(AdminRoles = "ViewSchoolTypeRef")]
    public ActionResult ViewSchoolType()
    {
        try
        {
            Guid SchoolTypeRefId = Request["SchoolTypeRefId"] != null ? new Guid(Request["SchoolTypeRefId"]) : Guid.Empty;
            ViewBag.merchantTypeRef = SchoolAdministrator.Models.SchoolAdminProduction.SchoolTypeRef.LoadSchoolTypeRef(SchoolTypeRefId, string.Empty, string.Empty, string.Empty);
        }
        catch (Exception e)
        {
            Commons.ErrorHandling.ReportError("SchoolAdministrator.Controllers.SchoolController ViewSchoolType",e);
        }
        return View();
    }

Model

    public class SchoolTypeRef
{
    /// <summary>
    /// This function allows us to load the School types if parametrs are empty, else load a single user by their ID 
    /// </summary>
    /// <param name="SchoolTypeRef">The merchant type ref id, unique ID</param>
    /// <param name="name">name of the School type</param>
    /// <param name="description">description of the School type</param>
    /// <returns>List of all users or list of a single user</returns>
      public static List<SchoolAdminProductionServices.SchoolTypeRef> LoadSchoolTypeRef(Guid SchoolTypeRef, string name, string description, string fdrSchoolTypeCode)
    {
        try
        {
            SchoolAdminProductionServices.SchoolAdminProductionServicesSoapClient client = new SchoolAdminProductionServices.SchoolAdminProductionServicesSoapClient();
            return client.LoadSchoolTypeRef(SchoolTypeRef, name, description, fdrSchoolTypeCode).ToList<SchoolAdminProductionServices.SchoolTypeRef>();
        }
        catch (Exception e)
        { 
            Commons.ErrorHandling.ReportError("SchoolTypeRef.LoadSchoolTypeRef()",e);
        }
        return new List<SchoolAdminProductionServices.SchoolTypeRef>();
    }
   }

View
THIS IS WHERE THE ERROR OCCURRED BETWEEN THE <% %>

   <%SchoolAdministrator.DarkstarAdminProductionServices.SchoolTypeRefmerchantTypeRef =
          ViewBag.SchoolTypeRef ??
            new SchoolAdministrator.SchoolAdminProductionServices.SchoolTypeRef();%>
<table>
 <tr>
       <td colspan="2" class="tableHeader"> School Type Ref Details</td>
   </tr> 
   tr>
       td class="label"> Name:</td>
       td class="content"><%=SchoolTypeRef.name%></td>
   /tr>
    tr>
       td class="label"> Description:</td>
       td class="content"><%=SchoolTypeRef.description%></td>
   /tr>
    tr>
       td class="label"> FDR SchoolType Code:</td>
       td class="content"><%=SchoolTypeRef.fdrSchoolTypeCode%></td>
  /tr>
/table>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T21:29:12+00:00Added an answer on June 6, 2026 at 9:29 pm

    Your web service call is returning a List<> of schoolRefTypes, but your view is trying to access the list as if it were a single instance of schoolRefTypes. Instead of assigning a list of schoolRefTypes to the viewbag, assign just one. A quick way to do this is use the .First() method to get the first element on the list. I’d imagine though you’d want to somehow restrict it to a specific schoolRefType based on the MVC convention of ID or something.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When we try to create a view within a funcion we get ERROR: there
when i try to view the databases in mysql i get this error: ERROR
I have the following View, Controller and Comment.cs code, but I get an error,
I'm working on MVC project and i using jQuery in view page to get
Whenever an error is thrown in my Razor view (.cshtml), I get a yellow
I get error: ORA-06575: Package or function GET_CONC_NAMES is in an invalid state When
Why do I get error in this code?Even if i do not link but
Why I get error with this query on my live server but not on
I have this query and I get error Operand should contain 1 column(s), whats
What is the best way to get error messages from a WF4 workflow back

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.