如何通过后面的代码添加用户控件 [英] How to add user control through code behind

查看:65
本文介绍了如何通过后面的代码添加用户控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我需要帮助.
我想动态地多次添加同一用户控件.
例如,如果对一张票证的答复数量大于一,则它会自动添加我的用户控件.

Tic.编号回复编号留言
456 .... 1 ......你好
456 .... 2 ......印度
456 .... 3 ...... vijay
456 .... 4 ......美国
456 .... 5 ......瑞士

* 点用于空格.它不显示任何内容.仅用于显示表格

然后我的控件应该出现5次,并且在每个用户控件中出现不同的消息.

在此先谢谢您.

Hello,

I want some help.
I want to add my same user control many times dynamically.
Like,if number of replies to one ticket is more than one,then it automatically add my user control.

Tic. No. Reply No. Message
456 .... 1 ...... hello
456 .... 2 ...... india
456 .... 3 ...... vijay
456 .... 4 ...... america
456 .... 5 ...... switzerland

*dots used for spaces.It renders nothing.just to show a table

Then my control should appear 5 times and appears different message in every user control.

Thanks in advance.

推荐答案

请在CP上参考本文:
Please refer to this article here on CP: Dynamically add and remove user controls[^].

That will tell you all you need to know.

Happy coding!


尝试一下

链接:[
^ ]
try this

Link :[^]


您可以为此使用循环.您需要在页面的PreRender事件中执行此操作,并确保将其添加到所有回发中.
You can make use of loops for that. You will need to do this in the PreRender event of the page and make sure you add it on all the postbacks.


这篇关于如何通过后面的代码添加用户控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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