Click here to Skip to main content
15,905,590 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,

I created the dynamic controls from DB and wrote the code in Page_PreInit and i had assigned the ID to Contols . Now my problem is that i find difficulty in acessing the controls values and store in DB.

Kindly Reply ASAP

Thanks in advance

VB
pnlControls.Controls.Add(New LiteralControl("<Table>"))
        For i = 0 To dt.Rows.Count - 1
            CtrlType = dt.Rows(i)(1).ToString
            CtrlName = dt.Rows(i)(2).ToString
            CtrlText = dt.Rows(i)(3).ToString
            Select Case CtrlType
                Case "TextBox"
                    pnlControls.Controls.Add(New LiteralControl("<tr>"))
                    pnlControls.Controls.Add(New LiteralControl("<td>" & CtrlText & "</td>"))
                    Dim box As New TextBox
                    pnlControls.Controls.Add(New LiteralControl("<td>"))
                    pnlControls.Controls.Add(box)
                    box.ID = CtrlName
                    pnlControls.Controls.Add(New LiteralControl("</td>"))
                    pnlControls.Controls.Add(New LiteralControl("</tr>"))



Now i want to iterate through the dynamic controls .

VB
For Each ctrl In pnlControls.Controls
            
            End If
        Next


I don't know how to code since it doesn't takes the controls placed in the placeholder .
Posted
Updated 1-Jun-10 4:40am
v2

1 solution

Hi,
Please check the following links:

http://www.4guysfromrolla.com/articles/081402-1.aspx

http://aspalliance.com/565


Regards,
Jamil
 
Share this answer
 
v2

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