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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:48:20+00:00 2026-05-20T09:48:20+00:00

i have gridview in my asp.net web application under framework 3.5. I am binding

  • 0

i have gridview in my asp.net web application under framework 3.5. I am binding the gridview with List. Inside the grid there is update and delete functionalities which are running fine. But my save functionality, for which i decided to extract the list back from the datasource and then through loop i will insert the new list to database. But when i tried to get it conventional way it returned me null.

I tried the following ways to retrieve the List back.

1. List<MyClass> list = (List<MyClass>gv.DataSource);
2. List<MyClass> list = gv.DataSource as List<MyClass>;
3. IDataSource idt = (IDataSource)gv.Datasource;
   List<MyClass> list = (List<MyClass>)idt;

But no luck, each time i got null.

  • 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-20T09:48:21+00:00Added an answer on May 20, 2026 at 9:48 am

    You cannot retreive the datasource once is is bound and the page is served. You have a few methods available to you to retain the datasource though:

    1. Store the data before binding in the Session
    2. Store the data before binding in the ViewState
    3. Fetch the data from the DB or whatever data store you retrieved it from originally.
    4. Keep an ongoing cache of changes stored somewhere else (eg Session, ViewState, etc)

    I prefer to stay away from drag and drop useage of datasources and binding data though.

    So in your case store the list somewhere accessible and manipulate it as you go along and rebind it each time. Then when you want to do that ‘save’ you can just deal with the underlying data object (List) that you have stored and is being used to define the GUI. The GridView is not a datastore, just a control to present the data based on a data store.

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

Sidebar

Related Questions

I have a ASP.NET 1.1 web application page which is built with .net framework
I have a GridView control in an Asp.net application, that has a <asp:buttonField> of
I have a web application that I am working on(ASP.NET 2.0 & C#). In
I'm working on replacing an existing web grid in an ASP.NET web application, with
I have a web application that I am working on(ASP.NET 2.0 C#). In it
I'm currently working on web application using VB in ASP.NET. Right now I have
i have a databound GridView in asp.net 2.0 with a row-selection link. When a
I have confusion about GridView in ASP.NET. How does the GridView exactly work? I
On an ASP.NET page, I have a GridView populated with the results of a
I'm using the ASP net Ajax toolkit and have a GridView within the UpdatePanel

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.