如何从在code使用jQuery背后动态创建的元素的值

问题描述:

感谢您抽出时间来asnwer我的问题。

Hi and thanks for taking the time to asnwer my question.

我有以下问题。我有一个表格和一个按钮,说:新增的活动。

I have the following problem. I have a form and a button which says "add new activities".

每当按钮被点击我添加了一套新的元素,即2下拉菜单+文本区域。我怎样才能获得code这些新创建的元素的值,因为后面我不知道它们的ID前面?

Whenever the button is clicked I add a new set of elements, namely 2 drop down menus + text area. How can I get the values of these newly created elements in code behind since I cannot know their ids up front?

如果有什么不清楚我的问题,请让我知道。

If there is something unclear about my question, please let me know.

再次感谢!

但你必须设置的ID(更重要的是 - name属性),使用某种模式的新元素。使用在服务器端code回路相同的模式,从的Request.Form 获取值。提供你把添加了服务器端项目总数隐藏的输入了解上限循环计数器。

But you must be setting id's (more importantly - name attributes) of new elements using certain pattern. Use the same pattern in a loop in server-side code to get values from Request.Form. Provide a hidden input where you put the total count of items added for the server-side to know the upper bound of loop counter.