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:
<%--Data sources--%>
<%--Data sources--%>
<%--details view--%>
<%--details view--%>
AppCode/ShopLogic.cs:
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();
}
Replies
Know the answer? Post it — somebody with the same question will find it here.