| | |
How will I Capture this Dynamic Data
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jan 2006
Posts: 1
Reputation:
Solved Threads: 0
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
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
- Catching Dynamic Button Events (ASP.NET)
- hard drive and usb cdrw not recognized in DOS (Storage)
- How to send an action to servlet through hyperlink and display the data on to jsp. (JSP)
- qbasic program under Windows XP (Legacy and Other Languages)
- hm.. wiered.. (C)
- struct error (!?) (C)
- QB compiled communication applications (Visual Basic 4 / 5 / 6)
Other Threads in the ASP.NET Forum
- Previous Thread: Why app is looking for "Default.aspx"
- Next Thread: Asp.net 2.0
| Thread Tools | Search this Thread |
.net 2.0 3.5 ajax alltypeofvideos appliances asp asp.net beginner box browser businesslogiclayer button c# c#gridviewcolumn cac checkbox class compatible confirmationcodegeneration content contenttype control countryselector courier dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash flv forms gridview gudi homeedition iis javascript jquery list listbox menu microsoft mouse mssql nameisnotdeclared news novell numerical opera order problem radio ratings redirect registration relationaldatabases reportemail schoolproject search security serializesmo.table sessionvariables silverlight smoobjects software sql sql-server ssl tracking treeview validatedate validation vb.net videos vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment webprogramming wizard xml xsl





