下面是我的代碼按鈕搜索我需要綁定我的網格和下載zip文件的問題有沒有zip文件是下載但我的網格是不綁定功能被稱爲但datalist不綁定後下載zip文件datalist是不是綁定
Private Sub BindGrid()
SQL = "Select JameatID,JamaatID,MadrassahID, JameatName,JamaatName,MadrassahName,StudentID,ClassID,DIvisionName,FullName,datediff (year ,DOB,getdate())as Age from vwstudent vw LEFT OUTER JOIN CMaster cm ON vw.ClassID =cm.CMID AND MasterName ='ClassID' where 1=1 order by JameatName,JamaatName,MadrassahName,cm.OrderId "
Dim ds As New dataset
ds = gc.GetDataToListBinder(SQL)
DListPhotoInfo.DataSource = ds
DListPhotoInfo.DataBind()
End Sub
Private Sub DownloadImage(ByVal EJID As String)
Dim DS As Data.DataSet
Dim tmpZipFile As String
tmpZipFile = System.IO.Path.GetTempFileName
Dim zipFile As New GraficaliZip(tmpZipFile)
zipFile.CreateZipFile()
Dim strID() As String = Split(EJID.Trim, ",")
For i As Integer = 0 To strID.Length - 1
If ImageExist(strID(i).Trim) = True Then
zipFile.PutFile(Server.MapPath(".") & _
"\Photo\" & strID(i).Trim & _
".jpg", strID(i).Trim & ".jpg")
End If
Next
BindGrid() ///from here i am binding grid
zipFile.SaveFile()
gc.DownLoadFileFromServer("", tmpZipFile & ".zip", "Photo.zip")
End Sub
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
DownloadImage("20312059,20313178")
PnlGrid.Visible = True
End Sub
你能還包括你的'BindGrid()'functi代碼上? – Adrian
我更新我的代碼bindgrid PLZ參考 – Harsh
可能是一些其他代碼破壞DataList。所以... 嘗試把斷點@ BindGrid()方法的最後一行。確認獲取的數據並正確綁定到DataList。然後逐步前進,以檢查哪些代碼在正確綁定後會干擾DataList。 –