是否有textboxlist控制可用的地方? [英] Is there a textboxlist control available somewhere?

查看:115
本文介绍了是否有textboxlist控制可用的地方?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有ASP控件,如单选按钮列表和的CheckBoxList,你可以将其数据绑定到一个数据库查询。这是伟大的与用户的交互创建动态列表。我正在试图做的是产生以同样的方式文本框的列表。该行为相同的方式文本框的列表。

There are ASP controls such as radiobuttonlist and checkboxlist and you can databind them to a database query. It's great for creating dynamic lists with user interaction. What I'm trying to do is generate a list of textboxes in the same fashion. A list of textboxes that behave the same way.

的目的是为具有经由数据源/数据库生成的CheckBoxList。当用户完成从该列表中选择的项目,在点击的按钮。该列表隐藏(使用jQuery)和一个新的列表是基于他们的选择创建。然而,新的名单现在伴随着一个空的文本框他们的选择清单。用户填写文本框的每个条目,并再次提交它提交到数据库。

The object is to have a checkboxlist that is generated via datasource/database. When the user is finished selecting items from this list, they click a button. That list hides (using jquery) and a new list is created based on their selections. However, the new list is now a list of their selections accompanied by an empty textbox. The user fills in the textboxes for each entry and submits again which commits it to a database.

SO:

checkbox - description
checkbox - description
checkbox - description
checkbox - description

变成了:

Description - Textbox
Description - Textbox

这是我正在寻找一个列表类型控件的原因是,我可以通过它最终环路提交到数据库使用LINQ。那有意义吗?我真正的问题是,如果有这样的控制呢。我给了万一有人充分说明有任何其他想法,总之创建自定义的控制。

The reason that I'm looking for a list-type control is so that I can ultimately loop through it for submission to the database using linq. Does that make sense? My real question is if there is a control like this yet. I gave the full description in case someone has any other ideas, short of creating a custom control.

推荐答案

有什么出做什么你描述没有盒子。但是,你仍然可以通过控制环。我会把你的窗体控件的ASP内部:面板或=服务器的div和像你描述使用类似下面的code循环通过它们

There's nothing out of the box that does what you describe no. But you can still loop through controls. I would put your form controls inside of an asp:Panel or a div with runat="server" and use something like the following code to cycle through them as you described.

foreach(Control ctl in myPanel.Controls)
{
  //check control type and handle
  if (ctl is TextBox)
  {
     //handle the control and its value here
  }
}

这篇关于是否有textboxlist控制可用的地方?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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