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 7920239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:08:25+00:00 2026-06-03T16:08:25+00:00

i am using ASP.NET MVC2 to implement google custom search. i am able to

  • 0

i am using ASP.NET MVC2 to implement google custom search. i am able to connect to googleAPI, pass my query, get the results back in JSON format and map those to .NET classes. However, when i create a view to show those results i am receving an error.

public ActionResult SiteSearch(string query)
        {
            var googleSiteSearchClient = new GoogleSiteSearchClient();
            var model = googleSiteSearchClient.RunSearch(query);
            return View(model);


        }

I create a strongly typed View based on Model and try to use a FOREACH loop to get the results

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>SiteSearch</h2>

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


                <%: item.Kind %> <br />

    <% } %>

    </table>

</asp:Content>

i am receving this error

The model item passed into the dictionary is of type ‘AASD2.Models.GoogleAPI.GoogleSearchResponse’, but this dictionary requires a model item of type ‘System.Collections.Generic.IEnumerable`1[AASD2.Models.GoogleAPI.GoogleSearchResponse]’.

any suggestion, where i am doing wrong?

  • 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-03T16:08:26+00:00Added an answer on June 3, 2026 at 4:08 pm

    Seems like the result of googleSiteSearchClient is not a collection. The search result collection is probably a property on the result of googleSiteSearchClient.

    Either use

       <% foreach (var item in Model.WhatEverTheCollectionIsNamed) { %>
    
    
                    <%: item.Kind %> <br />
    
        <% } %>
    

    Or

    public ActionResult SiteSearch(string query)
            {
                var googleSiteSearchClient = new GoogleSiteSearchClient();
                var model = googleSiteSearchClient.RunSearch(query);
                return View(model.WhatEverTheCollectionIsNamed);        
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using ASP.NET MVC2 and Entity Framework. I am going to simplify the
I'm using asp.net mvc2 and trying to send a list of json objects with
[NOTE: I'm using ASP.NET MVC2 RC2.] I have URLs like this: /customers/123/orders/456/items/index /customers/123/orders/456/items/789/edit My
I am using ASP.NET MVC2 with NHibernate, but am facing an issue. All calls
I have an asp.net mvc2 application that is using StructureMap 2.6 and NHibernate 3.x.
I am looking at ASP.NET MVC2 and trying to post a complex object using
I'm working on a asp.net mvc2 app. I have been using jquery to do
I'm using xval to use client side validation in my asp.net mvc2 web-application. Despite
I am using ASP.NET MVC2 on top of a MySQL database in VS2008. I
We've been working with ASP.Net MVC2 based web app. We're using DataAnnotations for model

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.