如何添加动态控件 [英] how to add Dynamic controls

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

问题描述

我想在我的aspx页面上创建一个添加文档按钮。在adddocument按钮上单击我想在页面上添加一些控件,如fileupload控件,文本框控件等。



问题 -

i想要那个按钮即使在回发或页面上存在控件之后每次单击它也能工作。



请任何人提出一些想法或帮我解决我的问题...



谢谢advance

解决方案

一种方法是创建一个单独的表单,其中根据需要定义文件上载的功能;然后单击该按钮打开此表单作为模型表单。


在上述链接中,使用页面的ViewState添加控件。数字是添加的控件由循环管理,循环用于显示控件。为了将最后一个条目存储在数据库中,有两种方式:



1.将一个关键字段作为主键,并在使用视图状态加载控件时也可以在数据库中添加控件。



2.只获取循环的最后一个值并将其传递给函数以在数据库中添加数据

I want to create a add document button on my aspx page. on adddocument button click i want to add some controls on the page like fileupload control, textbox control etc.

problem-
i want that button to work every time it was clicked even after postback or the controls are present on the page.

please any one give some idea or help me to solve my problem...

thanks in advance

解决方案

One way is that create a separate form in which the functionality of the File Upload is defined as per the requirement; and on the click of the button open this form as a model form.


In the above said link the controls are added using the ViewState of the page. The numbers are controls added are managed by the loop which is used to display the controls. In order to store the last entry in the database the two way are there:

1. Make a key field as primary key and when loading the controls using the view state add the controls in database also.

2. Get only the last values of the loop and that is passed to the function to add data in database


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

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