从动态加载的控件中获取值 [英] Get values from Dynamically loaded controls

查看:73
本文介绍了从动态加载的控件中获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我从数据库创建了动态控件,并在Page_PreInit中编写了代码,并已将ID分配给Contols.现在我的问题是我在获取控件值和存储在DB中时遇到困难.

请尽快回复

在此先感谢

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

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 .

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 .

推荐答案

您好,
请检查以下链接:

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

http://aspalliance.com/565


问候,
贾米尔(Jamil)
Hi,
Please check the following links:

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

http://aspalliance.com/565


Regards,
Jamil


这篇关于从动态加载的控件中获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆