| | |
How will I Capture this Dynamic Data
Please support our ASP.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
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 activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 beginner bottomasp.net browser businesslogiclayer c# cac checkbox class commonfunctions compatible content contenttype countryselector courier css dataaccesslayer database datagrid datagridview datagridviewcheckbox datalist deployment development dgv dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash flv formatdecimal formview gridview gudi iframe iis javascript listbox menu microsoft mouse mssql multistepregistration nameisnotdeclared news opera panelmasterpagebuttoncontrols problem redirect registration relationaldatabases reportemail schoolproject security serializesmo.table sessionvariables silverlight smartcard smoobjects software sql sql-server sqlserver2005 ssl textbox tracking treeview unauthorized validatedate validation vb.net video videos virtualdirectory vista visual-studio visualstudio web webapplications webarchitecture webdevelopemnt webdevelopment webprogramming webservice youareanotmemberofthedebuggerusers





