ASP.NET:“图像控制”吗?除了 ImageUrl 之外还有其他用于获取数据的属性吗?
我已经为如何将 FileUpload Web 控件数据保留在 Wizard Web 控件中而苦苦挣扎了几天。当我转到与 FileUpload 控件所在的步骤不同的步骤时,数据会丢失。
我发现这篇文章展示了如何将整个 FileUpload 控件保持在会话状态(如何在回发后维护 FileUpload 控件的状态)。
在本文中,作者使用会话来存储数据
Session["FileUpload1"] = FileUpload1;
现在,由于这篇文章,我能够在会话中保留 FileUpload 控件的副本,并且能够在我想要的任何向导步骤中调用它。
现在,我想知道在重新创建保存在会话中的 FileUpload 控件后,
FileUpload fp = (FileUpload)Session["FileUpload1"];
如何使用其中的数据来显示上传的图像。
Image1.ImageUrl =
看起来使用 ImageUrl 属性是错误的做法。那么有什么方法可以从 FileUpload 控件获取数据来显示图像吗?即除了 ImageUrl 之外,图像控件还有其他用于获取数据的属性吗?
感谢您的帮助
I've been struggling for a couple of days now on how to keep FileUpload web control data locate in a Wizard web control. When I go to a different step from the one in which the FileUpload control is located, the data is lost.
I've come across this article that shows how to keep the whole FileUpload Control in a Session State (How to Maintain FileUpload Control’s State after PostBack).
In this article, the author uses session to store data
Session["FileUpload1"] = FileUpload1;
Now, thanks to the article, I'm able to keep a copy of the FileUpload control in the session and am able to invoke it in any wizard step I want.
Now, I'd like to know how, after re-creating the FileUpload control saved in the Session
FileUpload fp = (FileUpload)Session["FileUpload1"];
I can use that data from it to display the image that was uploaded.
Image1.ImageUrl =
It looks like using the ImageUrl attribute is the wrong way of doing it. So Is there any way I can get data from the FileUpload control to display an image? i.e. does Image control have any other attribute that's used to get data, besides ImageUrl
Thanks for helping
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是在谈论
控件吗?如果是这样,那么这仅用于渲染 html。那么你还想用它做什么呢?如果您想在本地保存图像之前存储图像,那么我认为这是不可能的。
您需要在步骤之间保存来自 FileUpload 的图像才能显示它。
Are you talking about the
<asp:Image>
control? If so, then this is only used to render html.So what else are you wanting to do with it? If you are wanting to store an image before you save it locally, then I do not think this would be possible.
You would need to save the image from the FileUpload in between steps in order to display it.