从for循环中的文本框中获取值 [英] Get value from textbox in for loop

查看:99
本文介绍了从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 。由于 id 用于检索值,因此您只能看到一个。



解决方案:当您创建框,确保为每个创建不同的ID。像tbUcretBilgi1,tbUcretBilgi2,tbUcretBilgi3 ...
You created all boxes with same id. Since the id 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?


这篇关于从for循环中的文本框中获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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