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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:32:36+00:00 2026-05-15T07:32:36+00:00

I am attempting to use an existing stored procedure to populate a gridview. First,

  • 0

I am attempting to use an existing stored procedure to populate a gridview.

First, I execute the stored procedure and use a SqlAdapter to put it into a DataSet. I know this works because DataSet.Tables[0] contains my data. However, when I create a GridView and bind the data to the GridView, nothing is displayed.

Here is the code for binding the GridView:

DataSet ds = Execute_spr();
GridView testGridView = new GridView();

if (ds.Tables.Count > 0)
{
   testGridView.DataSource = ds.Tables[0].AsEnumerable();
   testGridView.DataBind();
}

and here is the code for my gridview in the .aspx page:

<asp:GridView ID="testGridView" runat = "server" AutoGenerateColumns = "true" />

Any idea what I might be doing incorrectly?

Edit: I have tried the ds.Tables[0] without AsEnumerable() and using .DefaultView

  • 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-15T07:32:37+00:00Added an answer on May 15, 2026 at 7:32 am

    Why are you re-initialising the Gridview in the line

    GridView testGridView = new GridView();
    

    Create a protected member in your codebeind called “testGridView”, remove the line above, and you might start to get somewhere…

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

Sidebar

Related Questions

I am attempting to transition an existing program to use the new time facilities
Attempting to use the data series from this example no longer passes the JSONLint
Attempting to use XStream's JavaBeanConverter and running into an issue. Most likely I'm missng
I have an existing ASP.Net Application, into which I am attempting to introduce MVC2.
I am attempting to use Beautiful Stone Soup (BSS) to modify existing XML that
I'm building a custom search page and attempting to use an existing custom search
I'm attempting to write a custom widget and I want to use existing UI
I'm attempting to make use of the Facebook C# SDK in my existing ASP.NET
attempting to use this railscast as a guide: http://railscasts.com/episodes/197-nested-model-form-part-2?view=asciicast and running into this error:
I am attempting integrate jQuery Mobile into an existing mobile page. I want to

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.