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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:34:52+00:00 2026-05-14T06:34:52+00:00

I have a DataGrid which is being bound dynamically to a database query. The

  • 0

I have a DataGrid which is being bound dynamically to a database query. The user enters some search text into a text field, clicks search, and the code behind creates the appropriate database query using LINQ (searches a table based on the string and returns a limited set of the columns).

It then sets the GridView datasource to be the query and calls DataBind().

protected void btnSearch_Click(object sender, EventArgs e)
{
    var query = from record in DB.Table
                where record.Name.Contains(txtSearch.Text) //Extra string checking etc. removed.
                select new
                {
                    record.ID,
                    record.Name,
                    record.Date
                };

    gvResults.DataSource = query;
    gvResults.DataBind();
}

This works fine.

When a user selects a row in the grid, the SelectedIndexChanged event handler gets the id from the row in the grid (one of the fields), queries the full record from the DB and then populates a set of editor / details fields with the records full details.

protected void gvResults_SelectedIndexChanged(object sender, EventArgs e)
{
    int id = int.Parse(gvResults.SelectedRow.Cells[1].Text);
    DisplayDetails(id);
}

This works fine on my local machine where I’m developing the code. On the production server however, the function is called successfully, but the row and column count on gvResults, the griview is 0 – the table is empty.

The gridview’s viewstate is enabled and I can’t see obvious differences. Have I made some naive assumptions, or am I relying on something that is likely to be configured differently in debug?

Locally I am running an empty asp.net web project in VS2008 to make development quicker. The production server is running the sitecore CMS so is configured rather differently.

Any thoughts or suggestions would be most welcome. Thanks in advance!

  • 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-14T06:34:52+00:00Added an answer on May 14, 2026 at 6:34 am

    Having poked around the sitecore forums some more, I came across this blog post explaining one potential solution.

    I added <type>System.Web.UI.WebControls.GridView</type> to the <typesThatShouldNotBeExpanded> section of Web.config and it seems to work for us.

    It seems to be to do with sitecore’s page layout rendering pipeline, where it expands sub-layouts and internal placeholders to generate the full page rendering. It accesses the .Net controls on the page and pokes them around a bit, which can cause some controls to not work correctly.

    There is an article on the SDN about this, although you can only read it if you have an account with sufficient privalegs. Hope this might help any other sitecore users out there in future.

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

Sidebar

Ask A Question

Stats

  • Questions 509k
  • Answers 509k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer if (managerStyle & DSNavigationManagerStyleDefaultNavigationBar || managerStyle & DSNavigationManagerStyleDefaultToolBarBit) { //… May 16, 2026 at 4:31 pm
  • Editorial Team
    Editorial Team added an answer The answer to your question is that you don't give… May 16, 2026 at 4:31 pm
  • Editorial Team
    Editorial Team added an answer Placing Thread.Sleep in an asynchronous method can contribute to ThreadPool… May 16, 2026 at 4:31 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a DataGrid which i am using on the page alogn with 4
I have a UltraWinGrid that is bound to a DataSet, in which a couple
I have a datagrid which shows all the headers of the rows. I have
I have a datagrid bound to an observable collection of objects. What I want
I have a WPF application which uses a (currently) local database to act as
Problem: I have an enumerated type which has description tags in the following style:
ASP.NET 1.1 - I have a DataGrid on an ASPX page that is databound
I'm building a winform app which uses datagrids, lists, textboxes which are bound to
I have a datagrid and I added silverlight 4 toolkit contextmenu to textbox in
how would you prevent dragging for some items of your List or DataGrid? Let's

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.