开发者

ASP.NET: Does "Image control" have any other attribute that's used to get data besides 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


Are you talking about the <asp:Image> control? If so, then this is only used to render html.

<img src="" alt="" title="" class="" customattribute="" />

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜