Click here to Skip to main content
15,892,965 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear all

I am trying to create dynmaic file upload control as many as i required....
when i am trying To read files in it then it is getting failed

I did as follows

in declaration section
VB
Dim TxtboxImageF As New FileUpload


creating controls in following way in loop as per my requirement and adding it in dynamic table and finally after ending loop adding table in placeholder
VB
TxtboxImageF = New FileUpload
TxtboxImageF.ID = CreateControlid("DOC", increamentvariable)
CellDocumentFrame.Controls.Add(TxtboxImageF)
RowDocumentFrame.Cells.Add(CellDocumentFrame)
TblDocumentFrame.Rows.Add(RowDocumentFrame)


after ending loop addin table in placeholder
VB
 PHobservations.Controls.Add(TblDocumentFrame)

Private Function CreateControlid(ByVal ctltype As String, ByVal docid As Integer) As String
        Dim Var_strbuildvalue As New StringBuilder
        Var_strbuildvalue.Length = 0
        Var_strbuildvalue.Append(ctltype)
        Var_strbuildvalue.Append("^")
        Var_strbuildvalue.Append(docid)
        CreateControlid = Var_strbuildvalue.ToString
    End Function


when i try to find the control it is getting failed in following way

VB
Dim i As Integer = "1"
TxtboxImageF = Me.FindControl("DOC^" & i)


please help
Posted
Updated 24-Jan-12 3:58am
v2
Comments
fjdiewornncalwe 24-Jan-12 9:58am    
Just added pre tags around your code blocks.

Is this involved with a master page or user control? If so, the actual ID may have something added in front to keep uniqueness. Run your app and then use the IE developer tools to find out what the actual ID is and see if that helps you find it better.
 
Share this answer
 
Hi,

Try using Ra Selector class [^].
Quote:
It's basically a full "selector engine" for the server-side which JavaScript DHTML developers probably well understand what means...

I'm using it and it works really great...

For your case look at IEnumerable<t> Select<t>(Control from, Predicate<control> predicate) method.

As I can see you are using VB.NET, not C#, so you must translate code to VB.NET or reference this as assembly dll into your project...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900