Asp.net 下载zip文件后,数据列表未绑定
下面是我的按钮搜索代码我需要绑定我的网格和下载zip文件问题是有zip文件下载,但我的网格不绑定函数被调用,但数据列表不绑定Asp.net 下载zip文件后,数据列表未绑定,asp.net,vb.net,sql-server-2005,visual-studio-2008,Asp.net,Vb.net,Sql Server 2005,Visual Studio 2008,下面是我的按钮搜索代码我需要绑定我的网格和下载zip文件问题是有zip文件下载,但我的网格不绑定函数被调用,但数据列表不绑定 Private Sub BindGrid() SQL = "Select JameatID,JamaatID,MadrassahID, JameatName,JamaatName,MadrassahName,StudentID,ClassID,DIvisionName,FullName,datediff (year ,DOB,getdate() )as Age
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()方法!页面加载事件中的IsPostBack
为了
此外,还需要在下载按钮单击事件中调用BindGrid()方法
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
zipFile.SaveFile()
gc.DownLoadFileFromServer("", tmpZipFile & ".zip", "Photo.zip")
**BindGrid()**
End Sub
更新:
首先调用下载方法,然后在单击搜索按钮时调用绑定方法
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
DownloadImage("20312059,20313178")
**BindGrid()**
PnlGrid.Visible = True
End Sub
编辑:
如果使用“更新”面板,则
调用UpdatePanelID.Update()
后调用BindGrid
()
- 当
控件嵌套在另一个UpdatePanel
控件中并且父面板被更新时UpdatePanel
您还可以包含
BindGrid()函数的代码吗?
我更新了BindGrid plz的代码,可能是其他代码破坏了数据列表。所以尝试将断点放在BindGrid()
方法的最后一行。确认获取的数据并正确绑定到DataList。然后一步一步前进,检查数据列表正确绑定后,代码的哪一部分正在干扰数据列表。请再次查看我的答案。下载zip文件后如何更新数据列表..更新面板也不刷新我的数据列表。Malummaat nahi数据列表不刷新需要帮助刷新我的数据列表下载映像(“2031205920313178”)BindGrid()PnlGrid.Visible=True我正在做同样的事情,但没有工作
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
DownloadImage("20312059,20313178")
**BindGrid()**
PnlGrid.Visible = True
End Sub