Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all articles
Browse latest Browse all 3509

populate gridview from an array

$
0
0

Hello,

I am trying to populate a gridview programatically from an array. What I am doing is storing the complete array for every row in a database field. I then need to pull it from the database basically in CSV format and manipulate it by splitting the info (I have this part I can do no problem). This can be anywhere from 3 to 32 rows

The string is stored in the database as follows. I have each row separated with a comma and each column in the row separated with a semicolon

Row 1 Col 1 data;Row 1 Col 2 data;Row 1 Col 3 data;Row 1 Col 4 data,Row 2 Col 1 data;Row 2 Col 2 data;Row 2 Col 3 data;Row 2 Col 4 data,.....

my question is how to get it into the gridview after splitting? Also, do I need to setup a data connection where I am not connecting directly to the database?

here is my code from the aspx page

<asp:GridView ID="GridView1" runat="server" PageSize="32" AutoGenerateColumns="false"><Columns><asp:BoundField DataField="Wins" HeaderText="Wins" ItemStyle-Width="30" /><asp:BoundField DataField="Players" HeaderText="Players" ItemStyle-Width="150" /><asp:BoundField DataField="Rd1" HeaderText="Round 1" ItemStyle-Width="150" /><asp:BoundField DataField="WorL1" HeaderText="" ItemStyle-Width="15" /><asp:BoundField DataField="Rd2" HeaderText="Round 2" ItemStyle-Width="150" /><asp:BoundField DataField="WorL2" HeaderText="" ItemStyle-Width="15" /><asp:BoundField DataField="Rd3" HeaderText="Round 3" ItemStyle-Width="150" /><asp:BoundField DataField="WorL3" HeaderText="" ItemStyle-Width="15" /><asp:BoundField DataField="Rd4" HeaderText="Round 4" ItemStyle-Width="150" /><asp:BoundField DataField="WorL4" HeaderText="" ItemStyle-Width="15" /><asp:BoundField DataField="Rd5" HeaderText="Round 5" ItemStyle-Width="150" /><asp:BoundField DataField="WorL5" HeaderText="" ItemStyle-Width="15" /><asp:BoundField DataField="Rd6" HeaderText="Round 6" ItemStyle-Width="150" /><asp:BoundField DataField="WorL6" HeaderText="" ItemStyle-Width="15" /></Columns></asp:GridView>


Viewing all articles
Browse latest Browse all 3509

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>