使用for循环将值插入文本框 [英] inserting values into textbox using for loop

查看:87
本文介绍了使用for循环将值插入文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,



我有10个文本框,ID为txt1到txt10。



我可以使用for将值插入5个文本框?

我试过...

 for (i =  0 ; i< 5; i ++)
{
TextBox t1 =(TextBox) this .FindControl( txt + i.ToString());
t1.text = any;
}



但没有用。



请帮忙。



提前致谢。

解决方案

请按照以下链接提供的答案。



1. Re:迭代控制页面 [ ^ ]。

2. 使用asp.net浏览文本框 [ ^ ]。



谢谢...

Dear friends,

I have 10 textboxes with id txt1 to txt10.

Can I use "for" to insert values into 5 text boxes?
I tried...

for(i=0;i<5;i++)
{
      TextBox t1 = (TextBox)this.FindControl("txt" + i.ToString());
      t1.text="any";
}


but of no use.

Please help.

Thanks in advance.

解决方案

Please follow the answer provided in below links.

1. Re: Iterate through controls of the page[^].
2. Iterating through textboxes using asp.net[^].

Thanks...


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

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