Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to add the selected file through Fileupload control on DataGrid while selecting Like Gmail Or Yahoo attachment.

How to do this while selecting the file.
Posted
Updated 5-Dec-11 21:44pm
v2

On Click on add attachment. Just save file on temp Loaction and Create a datatable and detail of the attachment in that datatable.

And finally give this datatable as datasource of the listview.

And on send mail you can clear the datatable and delete the attachment files
 
Share this answer
 
v2
Comments
Robymon 6-Dec-11 4:02am    
Can i get some solution for this?
Anuj Banka 6-Dec-11 4:38am    
Check the new solution that i have given. This is just a overview efforts you have to do.. If it help you mark as a answer
Place file upload control in item template.
ASP.NET
<columns>
<asp:TemplateField>
<itemtemplate></itemtemplate></columns>


Here file upload control

HTML
<itemtemplate>
</itemtemplate>


-Prashanth
 
Share this answer
 
v2
Comments
Robymon 6-Dec-11 4:03am    
I need to be like Gmail or Yahoo attachment. select the file, then after selecting it should add on to the Datagrid.
Do something Like this: you can modify this according to your need

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

       ListAttachment.Add(New Attachment With {.FileName = "YOr File Name"})
       ListView1.DataSource = ListAttachment
       ListView1.DataBind()
   End Sub



   Private _listAttachments As List(Of Attachment)
   Public Property ListAttachment() As List(Of Attachment)
       Get
           Return _listAttachments
       End Get
       Set(ByVal value As List(Of Attachment))
           _listAttachments = value
       End Set
   End Property
   Public Class Attachment
       Private _fileName As String
       Public Property FileName() As String
           Get
               Return _fileName
           End Get
           Set(ByVal value As String)
               _fileName = value
           End Set
       End Property
   End Class
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900