Split a Datagrid

D

David

I'm trying to split a datagrid after 30 rows and I dont want to use it
for paging purposes so please dont suggest the PageSize="30" option.
:)
--------------------------------------------------------------------------
This is one of my first thoughts but of course it doesnt work or else
I wouldnt be here asking for help. Thanks
--------------------------------------------------------------------------
Im using a SQL call

sqlString = "SELECT * FROM Table"
Dim sqlDataAdapter As New SqlClient.SqlDataAdapter(sqlString,
sqlConnection)
Dim Ds As New DataSet()
sqlDataAdapter.Fill(Ds, "table")

With Ds.Tables(0).Rows
If .Count > 30 Then
Dim numPages = .Count / 30
For i = 1 To -(Int(-numPages))
With Datagrid1
.DataSource = Ds
.DataMember = "table"
.DataBind()
End With
Response.Write("<br>")
Next
Else
With Datagrid1
.DataSource = Ds
.DataMember = "table"
.DataBind()
End With
End if
End With
--------------------------------------------------------------------------
Im look for the following affect

Datagrid1
----------------------------------------------
| Header | Header | Header | Header | Header |
----------------------------------------------
| 234 | 234232 | 56 | 2342 | 2345 |
----------------------------------------------
| 234 | 234232 | 56 | 2342 | 2345 |
----------------------------------------------
| 234 | 234232 | 56 | 2342 | 2345 |
----------------------------------------------
| 234 | 234232 | 56 | 2342 | 2345 |
 
B

bruce barker

look at the row to determine the number of grids, and either build a dataset
(copy the desired rows to a new dataset) or create a dataset view of the
desired rows and bind these to the grids. for sometime this simple i'd
probably use a repeater though.

-- bruce (sqlwork.com)


| I'm trying to split a datagrid after 30 rows and I dont want to use it
| for paging purposes so please dont suggest the PageSize="30" option.
| :)
| --------------------------------------------------------------------------
| This is one of my first thoughts but of course it doesnt work or else
| I wouldnt be here asking for help. Thanks
| --------------------------------------------------------------------------
| Im using a SQL call
|
| sqlString = "SELECT * FROM Table"
| Dim sqlDataAdapter As New SqlClient.SqlDataAdapter(sqlString,
| sqlConnection)
| Dim Ds As New DataSet()
| sqlDataAdapter.Fill(Ds, "table")
|
| With Ds.Tables(0).Rows
| If .Count > 30 Then
| Dim numPages = .Count / 30
| For i = 1 To -(Int(-numPages))
| With Datagrid1
| .DataSource = Ds
| .DataMember = "table"
| .DataBind()
| End With
| Response.Write("<br>")
| Next
| Else
| With Datagrid1
| .DataSource = Ds
| .DataMember = "table"
| .DataBind()
| End With
| End if
| End With
| --------------------------------------------------------------------------
| Im look for the following affect
|
| Datagrid1
| ----------------------------------------------
| | Header | Header | Header | Header | Header |
| ----------------------------------------------
| | 234 | 234232 | 56 | 2342 | 2345 |
| ----------------------------------------------
| | 234 | 234232 | 56 | 2342 | 2345 |
| ----------------------------------------------
| | 234 | 234232 | 56 | 2342 | 2345 |
| ----------------------------------------------
| | 234 | 234232 | 56 | 2342 | 2345 |
| ----------------------------------------------
| | 234 | 234232 | 56 | 2342 | 2345 |
| ----------------------------------------------
|
| Datagrid1
| ----------------------------------------------
| | Header | Header | Header | Header | Header |
| ----------------------------------------------
| | 234 | 234232 | 56 | 2342 | 2345 |
| ----------------------------------------------
| | 234 | 234232 | 56 | 2342 | 2345 |
| ----------------------------------------------
| | 234 | 234232 | 56 | 2342 | 2345 |
| ----------------------------------------------
| | 234 | 234232 | 56 | 2342 | 2345 |
| ----------------------------------------------
| | 234 | 234232 | 56 | 2342 | 2345 |
| ----------------------------------------------
|
| Thanks
| Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top