开发者

Get Text property with asp control

I created control using code:

...Page_Load(...)
{
...
TextBox tBox = new TextBox();
tBox.ID ="SpecificID";
somePanel.Controls.Add(tBox);
...
}

How to get Text property开发者_运维百科 with this control (like SpecificID.Text)???


TextBox textBox = Form.FindControl("yourid") as TextBox
string text = textBox.Text


TextBox textBox = somePanel.FindControl("SpecificID") as TextBox;
string text = textBox.Text;

i assume "somePanel" you have referred is a asp.net panel control you are using in the page.


        TextBox tBox = new TextBox();
        tBox.ID = "1";
        tBox.Text = "hi";
        form1.Controls.Add(tBox);

        string Text= tBox.Text;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜