DetailsView with FileUpload Control - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

DetailsView with FileUpload Control

shohamtalshohamtal Posts: 1Member
hello friends
i need some help:

i have a form with detailsView controls bounded to an ObjectDataSource.
inside the detailsView i have some textBoxes, dropDownLists and FileUpload control.

now the ObjectDataSource has another class to handle the insert method.

without the fileUpload everting is ok, but when i try to insert the file upload to the InsertParameters of ObjectDataSource, its not working.

any help will be appreciated!

here is the code...


default.aspx:

[code]<%--Data sources--%>





<%--Data sources--%>



<%--details view--%>




' >









' >













<%--details view--%>[/code]

AppCode/ShopLogic.cs:
[code]public void InsertNewShop(string title, string name, string phone, string site, string segment, object FileUpload)
{
FileUpload FileUpload1 = FileUpload as FileUpload;
//upload picture
string imagePath = "~/ShopsImages/" + DateTime.Now.ToString("ddmmyy_hhmmss") + FileUpload1.FileName;
string fullPath = HostingEnvironment.MapPath(imagePath);
FileUpload1.SaveAs(fullPath);


//create shop object
shop newShop = new shop();
newShop.title = title;
//...more code...
db.AddToshops(newShop);
db.SaveChanges();
}[/code]
Sign In or Register to comment.