fileupload in gridview

Posted by Sepede123 under ASP.NET on 9/5/2011 | Points: 10 | Views : 2220 | Status : [Member] | Replies : 2
i have a gridview with some columns that one of them is image column and i put fileupload object in this column at edittempelate mode and i want when i click on edit button in gride view the fileupload object authomatically show the path of picture that its row is chosen for edit ?
please send resolve to my mail


Posted by: Vuyiswamb on: 9/5/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

So you dont store the actual image, you store the path in the Database? If that is the case , you can bind the grid with the column that has a path and hide it on Databound() event and when someone click the Fileupload , just get the value of that "Path" field and do as you want with it.

Thank you for posting at Dotnetfunda

Sepede123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sepede123 on: 9/5/2011 [Member] Starter | Points: 25

ok,i save path of picture in database but i dont which code i use that fileupload show that authomatically when i execute it
of course it located in edittemplate of grideview ,i wrote thise code but it didnot answer!
protected void FileUpload2_Load(object sender, EventArgs e)
DataSet set=new DataSet();
string str1="select image from book ";
SqlDataAdapter da =new SqlDataAdapter(str1,con);

FileUpload FileUpload2=(FileUpload)sender;

infact i dont want use sqldatasource object, ihandle it whit codebehind

Sepede123, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response