Below is the gridview with 3 columns and column 1 has panel scrollbar for each item/row:
Column 1 | Column 2 | Column 3
---------------------------------------------------
12345 ↑ | |
14323 | |
43345 | |
45678 | |
↓ | |
-------------------------------------
3333 ↑ | |
32123 | |
544444 | |
99088 | |
↓ |
-------------------------------------
The code on aspx is working well, but I don't want to use it in aspx.
<asp:TemplateField>
<HeaderStyle Width ="215px" Font-Names ="Tahoma" Font-Size ="9pt" />
<ItemStyle Width ="215px" />
<ItemTemplate>
<asp:Panel ID="Panel1"
Runat="Server"
ScrollBars="Auto"
Height="30px"
Width="212px" >
<asp:Label ID="numbers"
Runat="Server"
Font-Names="tahoma"
Font-Size="8pt"
style="line-height: 10px; "
Text='<%# Eval("miscnumbers") %>'></asp:Label>
</asp:Panel>
</ItemTemplate>
<HeaderTemplate >
Column 1
</HeaderTemplate>
</asp:TemplateField>
So, I have a datatable in codebehind show as :
Private Sub GetNumbers()
'Create Table Manually
Dim dt As New DataTable()
'Add Columns to DataTable
dt.Columns.Add("Column 1", GetType(String))
dt.Columns.Add("Column 2", GetType(String))
dt.Columns.Add("Column 3", GetType(String))
' and add the DataTable rows and load the values from numbers/description
' in the gridview
For Each Info In Numbers
Dim dr As DataRow = dt.NewRow()
dr("Column 1") = Info.miscnumbers
dr("Column 2") = Info.Fnumbers
dr("Column 3") = Info.Description
dt.Rows.Add(dr)
Next
gridview1.DataSource = dt
gridview1.DataBind()
Dim bfield As New BoundField()
bfield.HeaderText = "Column 1"
bfield.HeaderStyle.Width = "175"
----> bfield.ItemStyle.scrollbar.FindControl(column1) ??????? (a panel with scrollbar inside of item gridview of thecolumn 1
bfield.DataField = "miscnumbers"
gridview1.Font.Bold = False
gridview1.AutoGenerateColumns = False
gridview1.Columns.Add(bfield)
End sub
How to add dynamically <asp:panel> scrollbar for the Column1 in the code behind.
Your help is much appreciated. Thanks.