Solved

GridView bind a 2d array

Posted on 2008-06-16
2
1,066 Views
Last Modified: 2013-11-26
Hi,

I have a 2 dimensional array ...

Dim arr(50, 3) as string

I have put the data into this array, but now i want to put the data from the array into a gridview.  Has anyone got the code to do this?

Thanks,

Darryl
0
Comment
Question by:yo_daz_uk
2 Comments
 
LVL 4

Accepted Solution

by:
zveljkovic earned 100 total points
ID: 21792358
Hi. here is some sample code for you.
			DataTable t = new DataTable("name");
//add coresponding number of columns or just go in for loop
			t.Columns.Add("col1");
			t.Columns.Add("col2");
			t.Columns.Add("col3");
			t.Columns.Add("col4");
//add new row 
			t.Rows.Add( new String[] {"asdf","qwer","ertt","rtyerty"});
			t.Rows.Add( new String[]  {"asdf","qwer","ertt","rtyerty"});
//databind
			this.dataGridView1.DataSource = t;

Open in new window

0
 

Author Closing Comment

by:yo_daz_uk
ID: 31467540
i used similar code to the above to achieve this
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question