S
Stephanie
I have a detailsview control. It is bound to an objectdatasource. I want to
have a fileupload control in the detailsview. So I added
<asp:TemplateField HeaderText="Photo"
SortExpression="pictureReference">
<EditItemTemplate>
<asp:FileUpload ID="pictureUpload" runat="server" />
</EditItemTemplate>
<InsertItemTemplate>
<asp:FileUpload ID="pictureUpload" runat="server" />
</InsertItemTemplate>
<ItemTemplate>
Dont know what I want to put here yet.
</ItemTemplate>
</asp:TemplateField>
Then I thought I would do something in the ItemUpdating event to save the
file (trivial) then have the field in the database reference the file name.
protected void ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
{
// do something here to 1. upload the file and 2. set the pictureReference
field to the path
string appPath = HttpContext.Current.Request.ApplicationPath;
string physicalPath = HttpContext.Current.Request.MapPath(appPath);
physicalPath = physicalPath + "\\images\\";
//pictureUpload.PostedFile.SaveAs(physicalPath +
pictureUplad.PostedFile.FileName);
}
pictureUpload does not exist in this context. But some of my drop down list
template fields do.
I am flailing around like a clueless person. Anyone have a nudge to give me
on what event and what to do when I get tehre?
Thanks!
have a fileupload control in the detailsview. So I added
<asp:TemplateField HeaderText="Photo"
SortExpression="pictureReference">
<EditItemTemplate>
<asp:FileUpload ID="pictureUpload" runat="server" />
</EditItemTemplate>
<InsertItemTemplate>
<asp:FileUpload ID="pictureUpload" runat="server" />
</InsertItemTemplate>
<ItemTemplate>
Dont know what I want to put here yet.
</ItemTemplate>
</asp:TemplateField>
Then I thought I would do something in the ItemUpdating event to save the
file (trivial) then have the field in the database reference the file name.
protected void ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
{
// do something here to 1. upload the file and 2. set the pictureReference
field to the path
string appPath = HttpContext.Current.Request.ApplicationPath;
string physicalPath = HttpContext.Current.Request.MapPath(appPath);
physicalPath = physicalPath + "\\images\\";
//pictureUpload.PostedFile.SaveAs(physicalPath +
pictureUplad.PostedFile.FileName);
}
pictureUpload does not exist in this context. But some of my drop down list
template fields do.
I am flailing around like a clueless person. Anyone have a nudge to give me
on what event and what to do when I get tehre?
Thanks!