Тип таблицы
я скачиваю файлы из gridview и вот так с этим покончено
Protected Sub GridView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles GridView1.SelectedIndexChanged Dim strKeyName() As String = {"DocID"} Dim objKeyVal() As Object = {GridView1.SelectedRow.Cells(1).Text} Dim DocExte As String = "" Dim DocuName As String = "" structDb = objDataSet.ExecSP("tbl", "getdoc", strKeyName, objKeyVal) If structDb.intCode = 0 Then Return Else If structDb.dstResult.Tables(0).Rows.Count > 0 Then For i = 0 To structDb.dstResult.Tables(0).Rows.Count - 1 Dim binary() As Byte = TryCast(structDb.dstResult.Tables(0).Rows(i).Item("document"), Byte()) Dim ms As MemoryStream = New MemoryStream(binary) DocExtension = structDb.dstResult.Tables(0).Rows(i).Item("DocExte") DocumentName = Now.Day & Now.Month & Now.Year * Now.Hour & Now.Minute & Now.Millisecond & DocExtension Response.Clear() Response.Buffer = True Response.Charset = "" Response.Cache.SetCacheability(HttpCacheability.NoCache) Response.ContentType = ContentType Response.AppendHeader("Content-Disposition", Convert.ToString("attachment;filename=") & DocuName ) Response.BinaryWrite(binary) Response.Flush() Response.[End]() Next End If End If End Sub
сейчас пытаюсь скачать из списка данных, но данные в списке как я могу получить значение, т. е. код документа из списка данных, как я могу получить это значение из таблицы через ячейки теперь, как я изменить в соответствии со списком данных
список данных СПС
Что я уже пробовал:
<asp:DataList ID="dl_Options" runat="server" Width="100%" DataKeyField="HisIndex" BorderColor="Black" BorderStyle="Solid" Font-Bold="False" BackColor="White" BorderWidth="0px"> <ItemTemplate> <table class="colordtd"> <tr> <td class="ProductPropertyLabel" width="100px">Customer Responce:</td> <td> <asp:Label ID="Label5" runat="server" Text='<%# Eval("GroupName") %>' /></td> <td class="ProductPropertyLabel" width="100px">Entry Date:</td> <td width="100px"> <asp:Label ID="Label6" runat="server" Text='<%# Eval("EntryDate") %>' /> </tr> <tr> <td class="ProductPropertyLabel" width="100px">Remarks:</td> <td width="300px"> <asp:Label ID="Label8" runat="server" Text='<%# Eval("Remarks") %>' /></td> <td class="ProductPropertyLabel" width="100px">File:</td> <asp:HiddenField ID="HiddenFieldDocID" runat="server" Value='<%# Eval("DocumentID")%>' /> <td width="100px"> <asp:LinkButton ID="lnkDownload" runat="server" CausesValidation="False" CommandArgument='<%# Eval("FileName")%>' CommandName="Download" Text='<%# Eval("FileName")%>' /> </tr> </table> </ItemTemplate> </asp:DataList> get doc sp is select DocID,document,DocuName ,DocExte from Downloads where DocumentID = @DocumentID now i modify according to like for download documents Protected Sub DownloadFile(sender As Object, e As EventArgs) Dim strKeyName() As String = {"DocID"} Dim ID As Guid = Guid.Parse(DirectCast(FindControl("HiddenFieldDocID"), HiddenField).Value) Dim objKeyVal() As Object = {ID} Dim DocExte As String = "" Dim DocuName As String = "" structDb = objDataSet.ExecSP("tbl", "getdoc", strKeyName, objKeyVal) If structDb.intCode = 0 Then Return Else Dim count As Integer = dl_Options.Items.Count For i As Integer = 0 To count - 1 Dim binary() As Byte = TryCast(dl_Options.Items(i),("document"), Byte()) Dim ms As MemoryStream = New MemoryStream(binary) DocExte = structDb.dstResult.Tables(0).Rows(i).Item("DocExtension") DocumentName = Now.Day & Now.Month & Now.Year * Now.Hour & Now.Minute & Now.Millisecond & DocExte Response.Clear() Response.Buffer = True Response.Charset = "" Response.Cache.SetCacheability(HttpCacheability.NoCache) Response.ContentType = ContentType Response.AppendHeader("Content-Disposition", Convert.ToString("attachment;filename=") & DocuName ) Response.BinaryWrite(binary) Response.Flush() Response.[End]() Next End If End Sub when i try this shows an error Type expected. on this line Dim binary() As Byte = TryCast(dl_Options.Items(i),("document"), Byte())