Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In My application i have the same page for view and insert.while inserting i am using file upload to store file name in view i want to bind data from database to that file upload control:
C#
txtTenderDocument = (tenderDetail[0].TenderDoc)Page.FindControl(txtTenderDocument.FileName);

but it shows error can not convert string to System.Web.UI.WebControls.FileUpload

Any suggestion........
Posted
Updated 27-Apr-13 0:09am
v3
Comments
Sandeep Mewara 27-Apr-13 6:10am    
Error says exactly what is the problem:
but it shows error can not convert string to System.Web.UI.WebControls.FileUpload

What is confusing?

1 solution

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;


C#
protected void Button2_Click(object sender, EventArgs e)
    {


if (FileUpload1.HasFile)
{
FileUpload1.SaveAs(Server.MapPath("img/") + FileUpload1.FileName);
Image1.ImageUrl = "img/" + FileUpload1.FileName;
Label1.Text = "uploaded";
}
]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900