My problem is that I have a gridview with five rows and an unknow number of columns. What I want to do is in row 1 I want each column to be a textbox and in the next row create a button/link to create a report for each column. My problem is only the last column is being changed to a textbox. Here is my code.
HTML Code:Protected Sub gvReport_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvReport.RowDataBound Dim link() As String Dim tb8 As New WebControls.TextBox If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowIndex = 1 Then ' Display the company name in italics. For i As Integer = 1 To e.Row.Cells.Count - 2 tb8.Width = 30 tb8.Font.Size = 12 tb8.Font.Name = "Times Roman" tb8.Text = e.Row.Cells(i).Text e.Row.Cells(i).Controls.Add(tb8) Next End If ReDim link(e.Row.Cells.Count - 1) If e.Row.RowIndex = 2 Then For i As Integer = 1 To e.Row.Cells.Count - 1 If e.Row.Cells(i).Text <> "N/A" Then e.Row.Cells(i).Text = "<u>" & e.Row.Cells(i).Text & "</u>" ' e.Row.Cells(i).Text = "<a href='mailto:" & e.Row.Cells(i).Text & "'>" & e.Row.Cells(i).Text & "</a>" link(i) = e.Row.Cells(i).Text End If Next End If End If End Sub


Reply With Quote

