日期:2014-05-18 浏览次数:20432 次
Private Sub GenerateTable(rows As Integer) Dim tableRows As Integer = rows '接收用户设置行数 Dim tableCells As Integer = 4 '4列 Dim tbId As Integer = 1 '由于一行有多个Textbox,要设置每个TextBox的ID唯一性。 For i As Integer = 1 To tableRows Dim tableRow As New TableRow() For j As Integer = 1 To tableCells Select Case j Case 1 '第一列 Dim tableCell1 As New TableCell() tableCell1.ClientIDMode = UI.ClientIDMode.Static tableCell1.ID = "tableCell1_" & i.tostring tableCell1.BorderWidth = Unit.Pixel(1) '添加资料类型下拉列表 Dim lstDocType As New DropDownList() lstDocType.ClientIDMode = UI.ClientIDMode.Static lstDocType.ID = "lstDocType" & i.ToString tableCell1.Controls.Add(lstDocType) tableRow.Cells.Add(tableCell1) Exit Select Case 2 '第二列 Dim tableCell2 As New TableCell() tableCell2.ClientIDMode = UI.ClientIDMode.Static tableCell2.ID = "tableCell2_" & i.tostring tableCell2.BorderWidth = Unit.Pixel(1) '添加语言选项 Dim chkDocLan As New RadioButtonList() chkDocLan.ClientIDMode = UI.ClientIDMode.Static chkDocLan.ID = "chkDocLan" & i.ToString chkDocLan.Items.Add("中文") chkDocLan.Items.Add("英文") chkDocLan.Items(0).Selected = True tableCell2.Controls.Add(chkDocLan) tableRow.Cells.Add(tableCell2) Exit Select Case 3 '第三列 Dim tableCell3 As New TableCell() tableCell3.ClientIDMode = UI.ClientIDMode.Static tableCell3.ID = "tableCell3_" & i.tostring tableCell3.BorderWidth = Unit.Pixel(1) '添加上传控件 Dim uploadDoc As New FileUpload() uploadDoc.ClientIDMode = ClientIDMode.[Static] uploadDoc.ID = "uploadDoc" & i.ToString() tableCell3.Controls.Add(uploadDoc) tableRow.Cells.Add(tableCell3) Exit Select End Select Next tableRow.ClientIDMode = UI.ClientIDMode.Static tableRow.ID = "rowUploadDoc" & i.ToString TableUploadLayout.Rows.Add(tableRow) Next End Sub
Protected Sub btnUploadDoc_Click(sender As Object, e As System.EventArgs) Handles btnUploadDoc.Click Dim intDocNumber As Integer = Convert.ToInt32(lblDocNumber.Text) '上传完毕后提示结果! Dim strReport As String strReport = "共上传了" & intDocNumber.ToString & "份资料:" & vbCrLf For i As Integer = 1 To i