动态添加控件的示例 [英] Example for dynamically added controls

查看:61
本文介绍了动态添加控件的示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!


有人可以告诉我或向我展示如何通过代码动态添加文本框和

按钮到apsx页面和用户单击按钮后如何从文本框中读取填写的
值?


我试过这个没有成功,因为用户点击后

按钮,文本框似乎消失了!我已将它添加到

占位符并试图用

ctype(placeholder1.controls.item(0),textbox).text读取它,但它不起作用...


我们的目标是提供一些文本框,并在按钮的click-ActionHandler中读取它们的输入数据! br />

谢谢,

Konrad

解决方案

" Konrad Hammerer" < ko ************* @ tesis.dewrote in message

news:11 *************** @ gzpc .tesis.de ...


有人可以告诉我或向我展示一个如何动态添加文本框和

按钮的示例代码到apsx页面以及如何在用户点击按钮后从文本框中读取填写的

值?

http://aspnet.4guysfromrolla。 com / articles / 092904-1.aspx

-

Mark Rae

ASP.NET MVP
< a rel =nofollowhref =http://www.markrae.nettarget =_ blank> http://www.markrae.net


Hello Konrad,

this.Controls.Add(new LiteralControl("< h3> Value:"));

---

WBR,

Michael Nemtsev [.NET / C#MVP] ::博客: http://spaces.live.com/laflour


对我们大多数人来说是最大的危险并不是说我们的目标太高而且我们错过了它,但是它太低了我们达到了它 (c)米开朗基罗

KHHi!

KH>

KHCan有人告诉我或向我展示如何添加文本框和

KHa按钮动态按代码到apsx页面以及如何在用户点击

KHbutton后从文本框中读取

KHfilled值?

KH>

KHI尝试过这个没有成功,因为在用户点击了按钮后,文本框似乎消失了!我已将它添加到

KHplaceholder并试图用

KHctype(placeholder1.controls.item(0),textbox).tex t读取它,但它没有

KHwork ...

KH>

KH目标是提供一些文本框并阅读
$ b $的输入数据b按钮的点击-ActionHandler中的KHthem!

KH>

KHThanks,

KHKonrad

Hello Konrad,


>

this.Controls.Add(new LiteralControl("< h3>值:"));



我真的不明白这应该如何解决我的问题?


Best,

Konrad


>

---

WBR,Michael Nemtsev [.NET / C#MVP]: :博客: http://spaces.live.com/laflour

对我们大多数人来说,最大的危险并不是我们的目标太高而且我们错过了它们,但是它太低而我们达不到它。 (c)米开朗基罗


KHHi!

KHKHCan有人告诉我或向我展示如何添加文本框和

KHa通过代码动态按钮到apsx页面以及如何在用户点击

KHbutton后从文本框中读取

KHfilled值?

KHKHI尝试了这个没有成功,因为在用户点击了b
$ b $按钮后,文本框似乎消失了!我已将它添加到

KHplaceholder并试图用

KHctype(placeholder1.controls.item(0),textbox).tex t读取它,但它没有

KHwork ...

KHKH的目标是提供一些文本框,并在click-ActionHandler中读取

KHthem的输入数据按钮!

KHKHThanks,

KHKonrad


Hi!

Can somebody tell me or show me an example how to add a textbox and a
button dynamically by code to an apsx page and how to read the filled in
value from the textbox after the user has clicked the button?

I have tried this without success because after the user has clicked the
button, the textbox seems to be disappeard! I have added it to a
placeholder and tried to read it with
ctype(placeholder1.controls.item(0),textbox).text, but it did not work...

The goal is to provide some textboxes and read the input data of them in
the "click"-ActionHandler of the button!

Thanks,
Konrad

解决方案

"Konrad Hammerer" <ko*************@tesis.dewrote in message
news:11***************@gzpc.tesis.de...

Can somebody tell me or show me an example how to add a textbox and a
button dynamically by code to an apsx page and how to read the filled in
value from the textbox after the user has clicked the button?

http://aspnet.4guysfromrolla.com/articles/092904-1.aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net


Hello Konrad,

this.Controls.Add(new LiteralControl("<h3>Value: "));
---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
KHHi!
KH>
KHCan somebody tell me or show me an example how to add a textbox and
KHa button dynamically by code to an apsx page and how to read the
KHfilled in value from the textbox after the user has clicked the
KHbutton?
KH>
KHI have tried this without success because after the user has clicked
KHthe button, the textbox seems to be disappeard! I have added it to a
KHplaceholder and tried to read it with
KHctype(placeholder1.controls.item(0),textbox).tex t, but it did not
KHwork...
KH>
KHThe goal is to provide some textboxes and read the input data of
KHthem in the "click"-ActionHandler of the button!
KH>
KHThanks,
KHKonrad


Hello Konrad,

>
this.Controls.Add(new LiteralControl("<h3>Value: "));

I do not really understand how this should solve my problem?

Best,
Konrad

>
---
WBR, Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and
we miss it, but that it is too low and we reach it" (c) Michelangelo

KHHi!
KHKHCan somebody tell me or show me an example how to add a textbox and
KHa button dynamically by code to an apsx page and how to read the
KHfilled in value from the textbox after the user has clicked the
KHbutton?
KHKHI have tried this without success because after the user has
clicked
KHthe button, the textbox seems to be disappeard! I have added it to a
KHplaceholder and tried to read it with
KHctype(placeholder1.controls.item(0),textbox).tex t, but it did not
KHwork...
KHKHThe goal is to provide some textboxes and read the input data of
KHthem in the "click"-ActionHandler of the button!
KHKHThanks,
KHKonrad


这篇关于动态添加控件的示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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