如何在Datagrid上添加Fileupload文件 [英] How to add Fileupload file on Datagrid

查看:75
本文介绍了如何在Datagrid上添加Fileupload文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在选择Like Gmail或Yahoo附件时通过DataGrid上的Fileupload控件添加所选文件.

选择文件时如何执行此操作.

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.

推荐答案

打开单击添加附件.只需将文件保存在temp Loaction上,然后在该数据表中创建数据表和附件的详细信息即可.

最后,将此数据表作为listview的数据源.

在发送邮件时,您可以清除数据表并删除附件文件
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


将文件上传控件放置在项目模板中.
Place file upload control in item template.
<columns>
<asp:TemplateField>
<itemtemplate></itemtemplate></columns>



此处的文件上传控件



Here file upload control

<itemtemplate>
</itemtemplate>



-Prashanth



-Prashanth


执行类似的操作:您可以根据需要进行修改

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


这篇关于如何在Datagrid上添加Fileupload文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆