Below code is from Course.aspx
<asp:Image runat="server" ImageUrl="ShowImage.ashx?id={?}" alt="" Width="600px" Height="450px" />
Below code is from CourseDetail.cs
var courseid = Request.QueryString["courseid"].ToString();
string sql = "SELECT * FROM Course where CourseID=@CourseID";
string[] name = { "@CourseID" };
string[] value = { courseid };
DataTable dt = DataBase.SQLselect(sql, name, value);
ShowImage.ashx?id={courseid}
this code works great. I check with any current number suc as ShowImage.ashx?id=5.
Now I want to know how I shloud call CourseID
in Course.aspx
:
ImageUrl="ShowImage.ashx?id={CourseID}
??
In aspx side put ID to your element.
<asp:Image runat="server" ID="imgCourse" alt="" Width="600px" Height="450px" />
Than in .cs side call your object.
imgCourse.ImageUrl="ShowImage.ashx?id=" + dt.courseID.ToString();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.