Hi sir,
I am using SqlDataAdapter i want to retrieve picture path from datbase to file upload control.
Below is code:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.QueryString["id"] != null)
{
SqlDataAdapter da = new SqlDataAdapter("select * from activity Where id=" + Request.QueryString["id"], con);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
TextBox1.Text = dt.Rows[0]["activityName"].ToString();
TextBox2.Text = dt.Rows[0]["amount"].ToString();
TextEditor1.Text = dt.Rows[0]["introduction"].ToString();
TextEditor2.Text = dt.Rows[0]["Overview"].ToString();
TextEditor3.Text = dt.Rows[0]["inclExcl"].ToString();
TextEditor4.Text = dt.Rows[0]["itinerary"].ToString();
TextEditor5.Text = dt.Rows[0]["Price"].ToString();
TextEditor6.Text = dt.Rows[0]["terms"].ToString();
Image1.ImageUrl = dt.Rows[0]["imagepath"].ToString();
Image2.ImageUrl = dt.Rows[0]["imagepath2"].ToString();
Image3.ImageUrl = dt.Rows[0]["imagepath3"].ToString();
Image4.ImageUrl = dt.Rows[0]["imagepath4"].ToString();
Image5.ImageUrl = dt.Rows[0]["imagepath5"].ToString();
}
}
}
}
<tr>
<td><asp:Image Height="80" ID="Image1" runat="server" /> </td>
<td> Image 1 <br /><asp:FileUpload ID="FileUpload1" runat="server" />
</td>
</tr>
<tr> <td colspan="2"> <hr /> </td></tr>
<tr>
<td><asp:Image Height="80" ID="Image2" runat="server" /></td>
<td> Image 2 <br /><asp:FileUpload ID="FileUpload2" runat="server" />
</td>
</tr>
In below daigram Activity Name 'Dubai City Tour' and the pictures on the left side coming from Database in the same way i want to display picture path in file upload control that i saved in database.


Regards
Firoz