动态创建的文本框不更新 [英] Dynamically created textboxes not updating

查看:84
本文介绍了动态创建的文本框不更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



i有asp.net web应用程序,其中我用来生成文本框列表依赖于表中的count.owever每当我加载细节我得到相同的输出每次都是TextBox。



请帮忙。



我尝试过:



生成所有控件后(TextBox,下拉列表等)我在下面这样做



TextBox txtRes1 =(TextBox)PlaceHolder1.FindControl(id1);

txtRes1.Text = concat(value1,valu2);



public int concat(strin v1,string v2)

{

return v1 + v2;

}

Hi,
i have asp.net web application in which i used to generate list of text boxes depend on count in table dynamically.however whenever I load the details I am getting the same output in the TextBox every time.

please help.

What I have tried:

after generating all controls(TextBox,dropdownlist etc) i am doing this below

TextBox txtRes1 = (TextBox)PlaceHolder1.FindControl("id1");
txtRes1.Text= concat(value1, valu2);

public int concat(strin v1, string v2)
{
return v1+v2;
}

推荐答案

Thanks guys.
i got the solution for this by creating a TextChanged event of a textbox in which i wanted to put the new changed value.

protected void TextBox1_TextChanged(object sender, EventArgs e)
{
string endDate = Request.Form[((TextBox)PlaceHolder1.FindControl("tb1")).UniqueID];
                                    string startDate = Request.Form[((TextBox)PlaceHolder1.FindControl("tb2")).UniqueID];

TextBox txtRes = (TextBox)PlaceHolder1.FindControl("tb31");
txtRes.Text = tbc.DateDiff(Convert.ToDateTime(endDate), Convert.ToDateTime(startDate));
}


这篇关于动态创建的文本框不更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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