Because the image control in asp.net is in the System.Web.UI.WebControls namespace, you cannot display the picture directly, as in WinForm, through byte[.
In this way, we can only curve the nation. The example here is the idea that teacherdetial.aspx is the final page to display text and pictures, but since our pictures need to be curved to save the nation, here's another pic.aspx. In the Pic.aspx page we display the picture and set the URL of the image control in teacherdetial.aspx to Pic.aspx. Finally we finished the request.
Teacherdetial.aspx's code is as follows
Copy Code code as follows:
<TD height= "align=" "right" > Photo: </td>
<td>
<asp:image id= "Image1" runat= "Server" width= "" "height=" "/>"
</td>
Teacherdetial.aspx.cs's code is as follows
Copy Code code as follows:
private string tid = null;
protected void Page_Load (object sender, EventArgs e)
{
tid = request.params["Tid"];
This. Image1.imageurl = "~/teacher/pic.aspx?tid=" + tid;
}
So we move the display of the picture to another page, and our image control just displays another page.
Pic.aspx's code is simple, just a new page can be.
The code for Pic.aspx.cs is as follows:
Copy Code code as follows:
protected void Page_Load (object sender, EventArgs e)
{
String tid = request.params["Tid"]. ToString ();
Teacherdao td = New Teacherdao ();
Response.BinaryWrite (Td.getpic (TID));
}