I am creating an application that will show an image when I click a button and browse on the dialog.
this is my sample layout and code:
+---------------------------------------------------+
| |
| |
| |
| CLICK HERE TO INSERT IMAGE |
| |
| |
| |
+---------------------------------------------------+
<asp:Panel ID="Panel2" runat="server" cssClass="containment-wrapper" style="border:1px solid #000000;">
<asp:FileUpload ID="FileUpload1" runat="server" style="display:none;"/>
<asp:ImageButton ID="MainImage" runat="server" CssClass="mainImage" ImageUrl="~/Image/ClickHere.png" OnClick="MainImage_Click"/>
</asp:Panel>
and my .CS file
protected void Page_Load(object sender, EventArgs e)
{
MainImage.Attributes.Add("onclick", "document.getElementById('" + FileUpload1.ClientID + "').click();");
}
protected void MainImage_Click(object sender, ImageClickEventArgs e)
{
}
I can click the "CLICK HERE TO INSERT IMAGE" and shows the file dialog, but my problem is how to get the selected image and show it on the buttonImage.