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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:58:03+00:00 2026-06-13T02:58:03+00:00

I have a List<string[]> items list filled with arrays of strings in my code.

  • 0

I have a List<string[]> items list filled with arrays of strings in my code. On the ASPX page, I have added a new grid view control:

<asp:GridView ID="ProductList" runat="server" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ProductID" EnableViewState="False">
  <Columns>
    <asp:BoundField DataField="ProductName" HeaderText="Product" SortExpression="ProductName" />
    <asp:BoundField DataField="CategoryName" HeaderText="Category" ReadOnly="True" SortExpression="CategoryName" />
    <asp:BoundField DataField="SupplierName" HeaderText="Supplier" ReadOnly="True" SortExpression="SupplierName" />
    <asp:BoundField DataField="UnitPrice" DataFormatString="{0:C}" HeaderText="Price" HtmlEncode="False" SortExpression="UnitPrice" />
    <asp:CheckBoxField DataField="Discontinued" HeaderText="Discontinued" SortExpression="Discontinued" />
  </Columns>
</asp:GridView>

I know that I should specify the DataSourceID attribute for the grid view in a fashion similar to this:

<asp:GridView ... `DataSourceID="ObjectDataSource1" ... > 
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetProducts" TypeName="ProductsBLL">
</asp:ObjectDataSource>

But, I don’t know what do OldValuesParameterFormatString, SelectMethod and TypeName attributes represent. Also, I don’t have the database to bind to, I just have the list of string arrays named items. Can you help me populate the grid view? It is not necessary to do it through the binding at all. Thanks!

  • 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-06-13T02:58:04+00:00Added an answer on June 13, 2026 at 2:58 am

    You don’t even need an ObjectDataSource. At Page_Load in the codebehind, you can parse through the string array list and create a DataTable on the fly.

    Make sure to wrap this around a Not Page.IsPostback so that it doesn’t rebind on postback.

    List<string[]> stringList = null;
    
    DataTable dt = new DataTable();
    DataRow dr = null;
    dt.Columns.Add("ProductName", System.Type.GetType("System.String"));
    dt.Columns.Add("CategoryName", System.Type.GetType("System.String"));
    dt.Columns.Add("SupplierName", System.Type.GetType("System.String"));
    dt.Columns.Add("UnitPrice", System.Type.GetType("System.Double"));
    dt.Columns.Add("Discontinued", System.Type.GetType("System.String"));
    
    foreach (string[] s in stringList) {
        foreach (string str in s) {
            dr = dt.NewRow();
            dr["ProductName"] = s[0];
            dr["CategoryName"] = s[1];
            dr["SupplierName"] = s[2];
            dr["UnitPrice"] = s[3];
            dr["Discontinued"] = s[4];
            dt.Rows.Add(dr);
        }
    }
    
    dt.AcceptChanges();
    ProductList.DataSource = dt;
    ProductList.DataBind();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a List and it is filled with strings like this: List<string> data
I have a String List with items like this Root Root/Item1 Root/Item2 Root/Item3/SubItem1 Root/Item3/SubItem2
I have a string list (TStrings) that has a couple thousand items in it.
I have a list which contains some items of type string. List<string> lstOriginal; I
I have a list of items (lets says 30 strings); I'm trying to figure
I have a List item List<string> xmlValue = new List<string>(); In this I have
Suppose I have one string list may have duplicated items: A B C A
Hi all I have list of type string with some items. i want to
I have a list that must be filled with a bit of code behind
I have list box(lstcategories) .. filled with items coming from database by using the

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.