如何将所有动态文本框值插入sqldb [英] how to insert all dynamic textbox values into sqldb

查看:74
本文介绍了如何将所有动态文本框值插入sqldb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的数据库中,所有控件均来自sql db.

in my databases all are controls comes in sql db.

If ds1.Tables(0).Rows(i)(0).ToString().Substring(0, 3) = "txt" Then

                       Dim lbl1 As New Label()
                       lbl1.ID = "lbl1" + i.ToString()
                       lbl1.Text = ds1.Tables(0).Rows(i)(1).ToString()
                       lbl1.Text = lbl1.Text + ":" + "       "
                       myDiv.Controls.Add(lbl1)

                       Dim MyTextBox As New TextBox()
                       MyTextBox.ID = ds1.Tables(0).Rows(i)(0).ToString()
                       myDiv.Controls.Add(MyTextBox)

                       'table = table & "<tr><td>" + ds1.Tables(0).Rows(i)(1).ToString() + "</td><td>" + MyTextBox.ID + "</td><td>"
                       myDiv.Controls.Add(New LiteralControl("<br />"))
                       'table = table + "</table>"
                       'myDiv.InnerHtml = table
                       div1.Attributes.Add("class", "button")
                   End If

                   If ds1.Tables(0).Rows(i)(0).ToString().Substring(0, 3) = "cbo" Then

                       Dim lbl2 As New Label()
                       lbl2.ID = "lbl2" + i.ToString()
                       lbl2.Text = ds1.Tables(0).Rows(i)(1).ToString()
                       lbl2.Text = lbl2.Text + ":" + "&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"
                       myDiv.Controls.Add(lbl2)


                       Dim ddl As New DropDownList()

                       ddl.AutoPostBack = True
                       'ddl.Height = "27px"
                       'ddl.Width = "130px"
                       ddl.ID = ds1.Tables(0).Rows(i)(0).ToString()
                       ddl.DataSource = ds1.Tables(0).Rows(i)(0).ToString()
                       ddl.DataBind()

                       myDiv.Controls.Add(ddl)
                       myDiv.Controls.Add(New LiteralControl("<br />"))

                       div1.Attributes.Add("class", "button")

                   End If




Dim txtUserName As TextBox = DirectCast(pnlInfo.FindControl(




Dim txtUserName As TextBox = DirectCast(pnlInfo.FindControl(

ds1.Tables(0).Rows(i)(0).ToString()), TextBox)

how to insert all dynamicall values into db.

i'm trying like this but problem is not resolved.

can u send me related examples.....

推荐答案

首先,您必须定义适当的表,以便从文本框中动态插入值.如果要获得适当的表结构,则可以参考DotNetNuke(DNN)动态表单生成概念.他们在DNN中为其创建了分层表.
First u have to define proper table for dynamic insertion of value from textbox. If u want to get proper table structure then u can refer DotNetNuke(DNN) dynamic form generation concept. In DNN they created layered table for same.


这篇关于如何将所有动态文本框值插入sqldb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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