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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:11:34+00:00 2026-05-22T17:11:34+00:00

i have tried the following code and it is giving error var res =

  • 0

i have tried the following code and it is giving error

var res = (from results in db.JobSearchAgents
                        where results.SiteID == 110 && results.UserID == sess
                        select new Agentlist
                        {
                            JobSearchAgentID = results.JobSearchAgentID.ToString(),

                            EmailAddress = results.EmailAddress,
                            Keywords = results.Keywords,


                            Country = results.Country,
                            zipcode = results.ZipCode,
                            miles = results.Miles.ToString()


                        }).AsEnumerable();
             ViewData["ajax"] = true;
             ViewData["scrolling"] = true;
             ViewData["paging"] = true;
             ViewData["filtering"] = true;
             ViewData["grouping"] = true;
             ViewData["sorting"] = true;
             ViewData["showFooter"] = true;
             //ViewData["searchresults"] = res;

            return View(res);


<%using (Html.BeginForm())
       {%>
       <%=Html.Telerik().Grid(Model).Name("Grid").Columns(columns=>
    {
        columns.Bound(m=>m.Keywords);
        columns.Bound(m=>m.Country);
    }).DataBinding(databinding=>
        {
            databinding.Server().Select("Agentlist","Grid",new
            {
           ajax=ViewData["ajax"]
            });
             databinding.Ajax().Select("Agentlist",
                "Grid").Enabled((bool)ViewData["ajax"]);
        })
        .Scrollable(scrolling => scrolling.Enabled((bool)ViewData["scrolling"]))
        .Sortable(sorting => sorting.Enabled((bool)ViewData["sorting"]))
        .Pageable(paging => paging.Enabled((bool)ViewData["paging"]))
        .Filterable(filtering => filtering.Enabled((bool)ViewData["filtering"]))
        .Groupable(grouping => grouping.Enabled((bool)ViewData["grouping"]))
        .Footer((bool)ViewData["showFooter"])


           %>
      <%}%>
  • 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-05-22T17:11:35+00:00Added an answer on May 22, 2026 at 5:11 pm

    The Error is because your query is trying to execute ToString method in db. using AsEnumerable you can tell the query to execute your methods in c#. you can either change your query to

    var res = (from results in db.JobSearchAgents
                            where results.SiteID == 110 && results.UserID == sess
                            select result).AsEnumerable().Select(result=>new Agentlist
                            {
                                JobSearchAgentID = results.JobSearchAgentID.ToString(),
    
                                EmailAddress = results.EmailAddress,
                                Keywords = results.Keywords,
    
    
                                Country = results.Country,
                                zipcode = results.ZipCode,
                               miles = results.Miles.ToString()
    
                            });
    

    Or you can bind your columns to telerik grid without calling ToString method. Telerik grid does not require the data to be in string format. Moreover, if you want data to be displayed in specific format you can call Format method when binding to the grid

    columns.Bound(m=>m.Keywords).Foramt("format string");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have tried the following code in net beans i am expecting error but
i have written the following code but it is giving parse error . here
I have tried the following code but has no effect: Imports system.Runtime.InteropServices <DllImport(UxTheme.DLL, BestFitMapping:=False,
I have tried for unload and beforeunload binding in following code, but none of
Anything I have tried didn't work. Currenly I have following code to change asp.net
I have following Code Block Which I tried to optimize in the Optimized section
I have tried the following two statements: SELECT col FROM db.tbl WHERE col (LIKE
I have tried with the following, but it just says & was unexpected at
I have tried the following code using the 2.0 framework and I get an
I currently have the following code coming from a database table: <h1 class=widgetHeader>My Friends</h1>

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.