从dropdownlist中选择项目时,Asp fileupload清除数据(页面回发) [英] Asp fileupload cleared data when selected item from dropdownlist (page postback)

查看:75
本文介绍了从dropdownlist中选择项目时,Asp fileupload清除数据(页面回发)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的页面asp.net有文件上传和图像和下拉列表

i想要当用户选择图像按文件上传时出现在图像中,当我从下拉列表中选择项目时没有清除文件上传数据
服务器端的
i wana代码

感谢时间

最好的问候

MHamdy


我尝试过:



< asp:FileUpload ID =ImageUploadToDB accept =image / *runat =serverVisible =trueTabIndex =2/>

< asp:Image ID =Image1runat =serverWidth =132pxHeight =120px/>

< asp:DropDownList ID =ddlCountriesCssClass =form-controlAutoPostBack =trueDataTextField =Countery_TxTDataValueField = Countery_IDAppendDataBoundItems =truerunat =serverTabIndex =5OnSelectedIndexChanged =ddlCountries_SelectedIndexChanged>

i have a simple page asp.net have file upload and image and drop down list
i want to when user select image by file upload appear in image and when i select item from drop down list not clear file upload data
i wana code in server side
thanks for time
best regards
MHamdy

What I have tried:

<asp:FileUpload ID="ImageUploadToDB" accept="image/*" runat="server" Visible="true" TabIndex="2" />
<asp:Image ID="Image1" runat="server" Width="132px" Height="120px" />
<asp:DropDownList ID="ddlCountries" CssClass="form-control" AutoPostBack="true" DataTextField="Countery_TxT" DataValueField="Countery_ID" AppendDataBoundItems="true" runat="server" TabIndex="5" OnSelectedIndexChanged="ddlCountries_SelectedIndexChanged">

推荐答案

很遗憾你不能这样做是为了安全原因。您需要在第一个回发上保存所选文件并为用户提供删除它的选项,或者将表单拆分为两个步骤,然后在下一步执行文件上载。
Unfortunately you can't do this for security reasons. You'll need to either save the selected file on the first postback and give the user an option to delete it, or split your form into two steps, where the file upload is the next step.


这篇关于从dropdownlist中选择项目时,Asp fileupload清除数据(页面回发)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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