从for循环中的文本框中获取值
问题描述:
我在for循环中创建了文本框
I created textboxes in for loop
for (int i = 0; i <= 6; i++)
{%>
<asp:TextBox ID="tbUcretBilgi" class="form-control" runat="server"></asp:TextBox>
}
我想从这些文本框中获取价值
但是我怎么可能,我不知道。
我尝试过:
我没有尝试任何东西,因为我找不到这个
I want to get values from these textboxes
but how I can, i don't know.
What I have tried:
I didn't try anything because I couldn't find about this
答
你用相同的 id $ c创建了所有的盒子$ C>。由于 id
用于检索值,因此您只能看到一个。
解决方案:当您创建框,确保为每个创建不同的ID。像tbUcretBilgi1,tbUcretBilgi2,tbUcretBilgi3 ...
You created all boxes with sameid
. Since theid
is used to retrieve the value, you see only one.
Solution: as you create the boxes, make sure you create a different id for each. Like tbUcretBilgi1, tbUcretBilgi2, tbUcretBilgi3 ...
如果ID与您创建的6个文本框相同,我想这里没有解决方案!
你想获得代码中的值,对吗?
I guess there's not a solution for this if the ID is the same to the 6 textboxes you have created!
Do you want to get the values in code behind, right?