动态添加文件上载控件 [英] Add File upload Control Dynamically

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

问题描述

Hiii

我需要动态创建文件上传控件,

我遇到的主要问题是当页面回发后控件消失

请给我一个解决方案,在回发之后控制和上传的文件仍然存在

解决方案

你好Remesh



您可以使用隐藏字段在页面上保存数据,并在服务器端决定如何处理它们。



像重新创建文件上传,填充默认数据,或使用先前插入的数据等。



干杯,

Edo


将您编写的代码用于生成上传控件,如下所示PageInit方法

  private   void  Page_Init( object  sender,EventArgs e)
{
// 您的代码在这里
}



不需要任何激活....只需将其粘贴到.cs代码隐藏文件中....希望这有帮助


Hiii
I need to Create File Upload control Dynamically,
The Major Problem I m Facing is that when the page gets post back the Controls Disappear
pls Give me a solution from which the control and uploaded file remains after postback

解决方案

Hi Remesh

You can use hidden fields to save data on the page and on the server side decide what to do with them.

Like re-create file upload, populate with default data, or with the previously inserted data etc.

Cheers,
Edo


Put the code that you have written for generating upload control in pageInit method like below

private void Page_Init(object sender, EventArgs e)
{
//your code here
}


There is no need for any activation....just copy paste it in the .cs codebehind file.... Hope this helps


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

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