PostBack上的自定义文本框值 [英] Custom text box value on PostBack
本文介绍了PostBack上的自定义文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的表单Asp上,我使用没有drak和drop方法的代码创建了一个TextBox(因为我需要通过从类(Web用户控件类)中调用方法(CreatetextBox)来创建灵活的表单来创建文本框) :
问题是:
当用户填写文本框并按保存为例时,我需要获取此自定义文本框的值
提前Thx
On My form Asp, I create a TextBox using the code without drak and drop method( cause i need to create a flexible form create a text box by calling a method (CreatetextBox)from the class (Web user Control Class)):
The Problem is :
When the user fill The Text Box and press Save for exemple i need to get the value of this custom TextBox
Thx in advance
推荐答案
HI,试试这个
HI , try this
foreach (Control ctrl in form1.Controls)
{
if (ctrl is TextBox)
{
//here you can store the value of textbox
string StoreValueToDB = ((TextBox)ctrl).Text;
}
if (ctrl is DropDownList)
{
//here you can store the value of textbox
string StoreValueToDB = ((DropDownList)ctrl).SelectedValue;
}
}
}
最后#天后,我找到了解决方法:
result.TextBoxValue = Request.Form ["TB_0
FINALLY AFTER # DAYS OF SEARCH I FIND THE SOLUTION :
result.TextBoxValue = Request.Form["TB_0
ctl01"];
TB_0
ctl01"];
TB_0
这篇关于PostBack上的自定义文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文