|
-
Dec 2nd, 2003, 06:34 PM
#1
Thread Starter
Frenzied Member
Dynamically create <tr> and input file fields
I have an ASP.NET application that allows a user to select if they want to upload an attachment.
If they check yes, then a dropdown list appears that allows them to select a number 1-5 to specify the number of files they will be uploading...
What I need to do it determine the number in the dropdown list, then dynamically create that many rows immediately below the dropdown list and add input type controls within a column of the newly created rows.
any ideas on the best way to do this?
Would a Repeater control be a good idea for this???
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Dec 2nd, 2003, 06:40 PM
#2
If you use the ASP.NET table then you can just add the rows in code on the selection type event of the combo.
Dim cntMax As Integer=Integer.Parase(combo1.SelectedText)
For cnt As Integer=1 to cntMax
Dim newRow As New TableRow()
Dim lbl As New Label()
lbl.Text="File #1"
newRow.Controls.Add(lbl)
tblUpload.Rows.Add(newRow)
Next
You could also just use an old time asp style script to handle it but asp.net is better.
Here I changed it a little bit, you'll probably have to do a little more to wire up the file upload input thingy, but...
VB Code:
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
Table1.Rows.Clear()
Dim cntmax As Integer = Integer.Parse(DropDownList1.SelectedItem.Text)
For cnt As Integer = 1 To cntmax
Dim newRow As New TableRow
Dim lbl As New Label
lbl.Text = "File #" & cnt & ": <INPUT type=""file"">"
Dim newCell As New TableCell
newCell.Controls.Add(lbl)
newRow.Controls.Add(newCell)
Table1.Rows.Add(newRow)
Next
End Sub
Last edited by Edneeis; Dec 2nd, 2003 at 06:55 PM.
-
Dec 2nd, 2003, 10:24 PM
#3
Thread Starter
Frenzied Member
Thanks for the help, but I think I am going to do it another way...instead of generating multiple file controls...I will just display 1 control and allow them to upload multiple attachments and keep track of how many they upload by adding and displaying them in a listbox.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|