Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.