943,945 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 4421
  • ASP.NET RSS
Jan 17th, 2006
0

How will I Capture this Dynamic Data

Expand Post »
Hi All,
I have problem in manipulation data grid.
The datagrid contains dynamic number of columns, and there is possibilty of the datagrid to be longer than the browser's viewport.
Users/clients will need to scroll horizontally, This can make user to loss track of the other part of the datagrid. So am thinking of transposing the data grid, so that the user will b able to scroll vertically.

My Problem is

1. How can I transpose a datagrid (vertical scrolling)
or

2. I have a work around, i built a dynamic table to solved the problem, How?
I transposed the dataTable and loop thru it to capture the values of each field. Each field contains html controls, Dont know why, web controls are not showing, They are all run at server. The string builder hold the html scripts to build the table.

my problem is how I capturing data from the controls....


Below is d code i used in creating the dynamic table ....

******** Code sample ***********************
Private Sub BuildGrid()
Dim sb As StringBuilder = New StringBuilder("")
Dim bTable As DataTable = objDataset.Tables("Groups")
Dim cTable As New DataTable

Dim dc As DataColumn
Dim dr As DataRow
Dim col As Integer = bTable.Columns.Count
Dim row As Integer = bTable.Rows.Count
Dim str As String = String.Empty
Dim i As Integer = 0
Dim j As Integer = 0

If DatasetIsEmpty(objDataset, bTable) Then
sb.Append("<table border='1'>")
sb.Append("<tr>")
cTable = TransposeTable(bTable, row, col)
sb.Append("<td>Group/Info</td>")
For i = 1 To row 'dc In cTable.Columns row change to column
sb.Append("<td>")
sb.Append("Group " & i)
sb.Append("</td>")
Next
sb.Append("</tr>")

For i = 0 To col - 1 'Each dr In cTable.Rows
' j = 0
' i = 0
'str = String.Empty
sb.Append("<tr>")

sb.Append("<td>")
sb.Append(bTable.Rows(0).Table.Columns(i).ColumnName.ToString)
sb.Append("</td>")

For j = 0 To row - 1 'Each dc In cTable.Columns
' If i = 0 Then
'End If
sb.Append("<td>")
'sb.Append(cTable.Rows(i).Item(j).ToString)

'sb.Append()
Select Case bTable.Rows(j).Table.Columns(i).DataType.ToString
Case "System.Boolean"
sb.Append("<input type='checkbox' name='chk" & j & i & "' value='checkbox' runat='server' />")
Case "System.Byte"
sb.Append("<input type='text' name='txt" & j & i & "' runat='server' />")
Case "System.Char"
sb.Append("<input type='text' name='txt" & j & i & "' runat='server' />")

Case "System.DateTime"
sb.Append("<input type='text' name='txt" & j & i & "' runat='server' />")

Case "System.Decimal"
sb.Append("<input type='text' name='txt" & j & i & "' runat='server' />")

Case "System.Decimal"
sb.Append("<input type='text' name='txt" & j & i & "' runat='server' />")

Case "System.Double"
sb.Append("<input type='text' name='txt" & j & i & "' runat='server' />")

Case "System.Int16"
sb.Append("<input type='text' name='txt" & j & i & "' runat='server' />")

Case "System.Int32"

sb.Append("<input type='text' name='txt" & j & i & "' runat='server' />")
Case "System.Int64"
sb.Append("<input type='text' name='txt" & j & i & "' runat='server' />")

Case "System.SByte"
sb.Append("<input type='text' name='txt" & j & i & "' runat='server' />")

Case "System.Single"
sb.Append("<input type='text' name='txt" & j & i & "' runat='server' />")

Case "System.UInt16"
sb.Append("<input type='text' name='txt" & j & i & "' runat='server' />")

Case "System.UInt32"
sb.Append("<input type='text' name='txt" & j & i & "' runat='server' />")

Case "System.UInt64"
sb.Append("<input type='text' name='txt" & j & i & "' runat='server' />")

Case Else
sb.Append("<input type='text' name='txt" & j & i & "' runat='server' value='" & bTable.Rows(j).Item(i).ToString & "' />")
End Select
sb.Append("</td>")

Next
sb.Append("</tr>")

Next

'for i = 1
sb.Append("</table>")
litShow.Text = sb.ToString
Else
Response.Write("Empty Record")
End If

End Sub

******** end of code ************************


3. I want to know how i can capture data dynamically from the table.
Note: Name of control, different control on d same column etc

Thanks
abacus
Last edited by abacusdotcom; Jan 17th, 2006 at 7:57 am. Reason: vague statement found
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
abacusdotcom is offline Offline
1 posts
since Jan 2006
Jan 17th, 2006
0

Re: How will I Capture this Dynamic Data

Why not just use the datalist control? You have full control over it then and much better for your situation than the grid
Reputation Points: 26
Solved Threads: 11
Posting Whiz in Training
f1 fan is offline Offline
275 posts
since Jan 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Why app is looking for "Default.aspx"
Next Thread in ASP.NET Forum Timeline: Asp.net 2.0





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC