Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Member
151 Points
339 Posts
Apr 25, 2012 06:35 AM|LINK
basheerkal No. When You click Insert Button both happens. Upload and inserting file name to DB along with other values.
No. When You click Insert Button both happens. Upload and inserting file name to DB along with other values.
Thanks,
I have been working hard to ge it to work, but no joy yet :-(
I have altered the Formview to include:
<asp:FormView ID="FormView2" runat="server" DataKeyNames="RecordNo"
DataSourceID="" DefaultMode="Insert" OnItemInserted="FormView2_ItemInserting" HorizontalAlign="Center">
And added the File upload:
<td class="style16" colspan="3">
<asp:FileUpload ID="FileUpload1" runat="server" />
</td>
I know something is missing here, but cannot figure out how to use your code to work here ?
The Code behind page look like this:
Protected Sub FormView2_ItemInserting(sender As Object, e As FormViewInsertEventArgs)
Dim fu As FileUpload = DirectCast(FormView2.FindControl("FileUpload1"), FileUpload)
If fu.HasFile = True Then
e.Values("PictureFilename") = fu.PictureFileName
fu.SaveAs("<path to folder>" + FileUpload1.PictureFileName)
Response.Clear()
Response.Redirect("confirmpage.aspx")
Response.[End]()
End If
End Sub
How do I proceed from here ?
Best regards
ricas
Member
151 Points
339 Posts
Re: Combine data insert and file upload into one page
Apr 25, 2012 06:35 AM|LINK
Thanks,
I have been working hard to ge it to work, but no joy yet :-(
I have altered the Formview to include:
<asp:FormView ID="FormView2" runat="server" DataKeyNames="RecordNo"
DataSourceID="" DefaultMode="Insert" OnItemInserted="FormView2_ItemInserting" HorizontalAlign="Center">
And added the File upload:
<td class="style16" colspan="3">
<asp:FileUpload ID="FileUpload1" runat="server" />
</td>
I know something is missing here, but cannot figure out how to use your code to work here ?
The Code behind page look like this:
Protected Sub FormView2_ItemInserting(sender As Object, e As FormViewInsertEventArgs)
Dim fu As FileUpload = DirectCast(FormView2.FindControl("FileUpload1"), FileUpload)
If fu.HasFile = True Then
e.Values("PictureFilename") = fu.PictureFileName
fu.SaveAs("<path to folder>" + FileUpload1.PictureFileName)
Response.Clear()
Response.Redirect("confirmpage.aspx")
Response.[End]()
End If
End Sub
How do I proceed from here ?
Best regards
..... I am new to all this, so please be patient