AsyncFileUpload Inside Repeater
AsyncFileUpload Inside Repeater Asp.Net
Saya akan membuat contoh kodingannya berikut ini :
HTML :
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<cc1:ModalPopupExtender ID="popup" runat="server" DropShadow="false" PopupControlID="pnlAddEdit" TargetControlID="lnkFake" BackgroundCssClass="modalBackground"></cc1:ModalPopupExtender>
VB.NET
Imports AjaxControlToolkit
Imports System.Web.Security.Membership
Imports System.Net
Imports System.Web.Security
Protected Sub FileUploadComplete(ByVal sender As Object, ByVal e As EventArgs)
For Each items As RepeaterItem In Repeater1.Items
Dim AsyncFileUpload1 As AsyncFileUpload = TryCast(items.FindControl("AsyncFileUpload1"), AsyncFileUpload)
Dim filename As String = System.IO.Path.GetFileName(AsyncFileUpload1.FileName)
AsyncFileUpload1.SaveAs(Server.MapPath("~/i_profil/") + filename)
SampleDB.ExecuteNonQuery("UPDATE tbl_Files_2 SET FileName='" & filename & "',FilePath='" & ("i_profil/") + filename & "' WHERE produk_id='" & User.Identity.Name & "'")
Lsukses.Text = "Upload Gambar Berhasil,Silakan Refresh Untuk Melihat Perubahan !"
Next
End Sub
Kode ini berjalan Normal di visual studio 2015.
Sekian dan Terimakasih,Semoga Bermanfaat.
0 Komentar