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

  • Home
  • SEARCH
  • 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 6121355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:46:28+00:00 2026-05-23T15:46:28+00:00

I am trying to bind this to a gridview.. var source = from p

  • 0

I am trying to bind this to a gridview..

 var source = from p in allComments
                 select new { p.Img, p.Name, p.Comment };
    GridView1.DataSource = source;
    GridView1.DataBind();

all Comments has
But it wont bind cause my gridview allows paging. I read a bit about that problem and i found to bind the gridview ,, i could use ObjectDataSource… And return a dataset to bind to the gridview..

I have got this mark up of the gridview (only part of the mark up):

      <asp:TemplateField HeaderText="#">
                    <HeaderStyle Width="500px" />
                     <ItemStyle Width="500px" Height="100px" />
                    <ItemTemplate>
                        <asp:Label ID="lblMessage" runat="server"  Text='<%# Bind("Comment") %>'></asp:Label>
                    </ItemTemplate>
   </asp:TemplateField>

       <asp:TemplateField HeaderText="#">
                    <HeaderStyle Width="100px" />
                      <ItemStyle Width="100px" Height="100px" />
                    <ItemTemplate>
                        <asp:Image ID="imgName" runat="server"  imageUrl='<%# Bind("Img") %>'></asp:Image><br />
                        <asp:Hyperlink ID="hyperLink" runat="server"  Text='<%# Bind("Name") %>' ></asp:Hyperlink>
                    </ItemTemplate>
   </asp:TemplateField>

What do you think..Should I use objectdataSource?

  • 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-23T15:46:29+00:00Added an answer on May 23, 2026 at 3:46 pm

    If you use ObjectDataSource, then Paging and Sorting will automatically work. I would recommend you to use the ObjectDataSource as it has many other features that you can use, like caching etc…
    Please check this link Displaying Data With the ObjectDataSource

    Check out this for more about ObjectDataSource http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.aspx

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

Sidebar

Related Questions

I'm new to JavaFX, trying to use bind like this: public function newCircle() :
I'm trying to bind columns from two different tables in to gridview using Linq
I'm trying to bind the dhcpctl library to Java using JNA. This is mi
This is the exception that I'm getting when I'm trying to bind to a
i am trying to use this code to bind my asp.net menu control to
I'm trying to show a 24 hours format using this line: Text='<%# Bind(Appointment, {HH:mm})
I am trying to bind to a static property on a static class, this
I am trying to bind an ASP.NET GridView control to an string array and
I'm trying to use LINQ to bind the data in my GridView. In my
I'm trying to bind my GridView at runtime, but I'm also trying to avoid

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.