Hi.
I have a code that shows some files in gridview and I can download them. I have .xslx and .sim files
the name of this file is: Result_x and FinalModel_x
x is some numbers.
now this is my gridview code:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CssClass="table table-bordered" EmptyDataText="No files uploaded" HorizontalAlign="Center">
<Columns>
<asp:BoundField DataField="Text" HeaderText="File Name" />
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkDownload" Text="Download" CommandArgument='<%# Eval("Value") %>' runat="server" OnClick="DownloadFile"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkShowChrt" Text="ShowCharts" CommandArgument='<%# Eval("Value") %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
VB file
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
InitialPage()
End Sub
Protected Sub InitialPage()
Dim filePaths As String() = Directory.GetFiles(Server.MapPath("~/Admin/ExResults/"), "Results_" + lblNationalCode.Text + "*")
Dim filePaths1 As String() = Directory.GetFiles(Server.MapPath("~/Admin/ExResults/"), "FinalModel_" + lblNationalCode.Text + "*")
Dim Xlsxfiles As List(Of ListItem) = New List(Of ListItem)()
For Each filePath As String In filePaths
Xlsxfiles.Add(New ListItem(System.IO.Path.GetFileName(filePath), filePath))
Next
Dim Simfiles As List(Of ListItem) = New List(Of ListItem)()
For Each filePath As String In filePaths1
Simfiles.Add(New ListItem(System.IO.Path.GetFileName(filePath), filePath))
Next
Dim Files = Xlsxfiles.Concat(Simfiles)
GridView1.DataSource = Files
GridView1.DataBind()
End Sub
Protected Sub DownloadFile(ByVal sender As Object, ByVal e As EventArgs)
Dim filePath As String = CType(sender, LinkButton).CommandArgument
Response.ContentType = ContentType
Response.AppendHeader("Content-Disposition", ("attachment; filename=" + Path.GetFileName(filePath)))
Response.WriteFile(filePath)
Response.End()
End Sub
Results_123 and FinalModel_123
if you copy 2 above file in the directory that mention in the code and change the name of the like:
gridview show them in 2 row.(gridview just show the files that have the same end)
now I want to merge this 2 row in one row and show them like below:
.sim file Donwload link .xlsx file Download link ShowChart
I don't want to show the ShowChart for .sim file. I want to show it just for . xlsx files.